mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-18 16:02:53 +08:00
Update paths
This commit is contained in:
parent
c22ac6d681
commit
75675ea19f
10857
package-lock.json
generated
Normal file
10857
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@ import { camelCase, clone } from 'lodash';
|
||||
export const ROOT = path.resolve(__dirname, '../../');
|
||||
export const TS_CONFIG = clone(require(path.resolve(ROOT, 'tsconfig.json')));
|
||||
export const COMPILER_OPTIONS = TS_CONFIG.compilerOptions;
|
||||
export const PLUGINS_ROOT = path.join(ROOT, 'src/plugins/');
|
||||
export const PLUGINS_ROOT = path.join(ROOT, 'src/@ionic-native/plugins/');
|
||||
export const PLUGIN_PATHS = fs.readdirSync(PLUGINS_ROOT).map(d => path.join(PLUGINS_ROOT, d, 'index.ts'));
|
||||
|
||||
export function getDecorator(node: ts.Node, index: number = 0): ts.Decorator {
|
||||
|
@ -32,7 +32,7 @@ export function getProgram(rootNames: string[] = createSourceFiles()) {
|
||||
|
||||
// hacky way to export metadata only for core package
|
||||
export function transpileNgxCore() {
|
||||
getProgram([path.resolve(ROOT, 'src/core/index.ts')]).emit({
|
||||
getProgram([path.resolve(ROOT, 'src/@ionic-native/core/index.ts')]).emit({
|
||||
emitFlags: EmitFlags.Metadata,
|
||||
emitCallback: ({ program, writeFile, customTransformers, cancellationToken, targetSourceFile }) =>
|
||||
program.emit(targetSourceFile, writeFile, cancellationToken, true, customTransformers)
|
||||
|
@ -23,7 +23,7 @@ export const EMIT_PATH = path.resolve(ROOT, 'injectable-classes.json');
|
||||
export function extractInjectables() {
|
||||
return (ctx: ts.TransformationContext) => {
|
||||
return tsSourceFile => {
|
||||
if (tsSourceFile.fileName.indexOf('src/plugins') > -1) {
|
||||
if (tsSourceFile.fileName.indexOf('src/@ionic-native/plugins') > -1) {
|
||||
ts.visitEachChild(tsSourceFile, node => {
|
||||
if (node.kind !== ts.SyntaxKind.ClassDeclaration) {
|
||||
return node;
|
||||
|
@ -55,7 +55,7 @@ function transformClasses(file: ts.SourceFile, ctx: ts.TransformationContext, ng
|
||||
export function pluginClassTransformer(ngcBuild?: boolean): ts.TransformerFactory<ts.SourceFile> {
|
||||
return (ctx: ts.TransformationContext) => {
|
||||
return tsSourceFile => {
|
||||
if (tsSourceFile.fileName.indexOf('src/plugins') > -1)
|
||||
if (tsSourceFile.fileName.indexOf('src/@ionic-native/plugins') > -1)
|
||||
return transformClasses(tsSourceFile, ctx, ngcBuild);
|
||||
|
||||
return tsSourceFile;
|
||||
|
@ -2,5 +2,5 @@
|
||||
"sitePath": "../ionic-site",
|
||||
"v2DocsDir": "docs/native",
|
||||
"docsDest": "../ionic-site/content/docs/native",
|
||||
"pluginDir": "dist/plugins"
|
||||
"pluginDir": "dist/@ionic-native/plugins"
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ module.exports = currentVersion => {
|
||||
|
||||
readTypeScriptModules.basePath = path.resolve(__dirname, '../../..');
|
||||
readTypeScriptModules.sourceFiles = [
|
||||
'./src/plugins/**/*.ts'
|
||||
'./src/@ionic-native/plugins/**/*.ts'
|
||||
];
|
||||
})
|
||||
|
||||
|
@ -52,12 +52,12 @@ module.exports = currentVersion => {
|
||||
readFilesProcessor.basePath = path.resolve(__dirname, '../../..');
|
||||
|
||||
readTypeScriptModules.basePath = path.resolve(path.resolve(__dirname, '../../..'));
|
||||
readTypeScriptModules.sourceFiles = ['./src/plugins/**/*.ts'];
|
||||
readTypeScriptModules.sourceFiles = ['./src/@ionic-native/plugins/**/*.ts'];
|
||||
})
|
||||
|
||||
// Configure file writing
|
||||
.config(function(writeFilesProcessor) {
|
||||
writeFilesProcessor.outputFolder = './dist/';
|
||||
writeFilesProcessor.outputFolder = './dist/@ionic-native/';
|
||||
})
|
||||
|
||||
// Configure rendering
|
||||
|
@ -10,7 +10,7 @@ module.exports = function readmes(renderDocsProcessor) {
|
||||
docs = docs.filter(doc => (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page');
|
||||
|
||||
docs.forEach(doc => {
|
||||
doc.outputPath = doc.outputPath.replace('src/', '');
|
||||
doc.outputPath = doc.outputPath.replace('src/@ionic-native/', '');
|
||||
});
|
||||
|
||||
return docs;
|
||||
|
@ -9,7 +9,7 @@ import { ROOT } from '../build/helpers';
|
||||
const DIST = path.resolve(ROOT, 'dist');
|
||||
const INDEX_PATH = path.resolve(DIST, 'index.js');
|
||||
const INJECTABLE_CLASSES = fs.readJSONSync(EMIT_PATH).map((item: InjectableClassEntry) => {
|
||||
item.file = './' + item.file.split(/[\/\\]+/).slice(-3, -1).join('/');
|
||||
item.file = './' + item.file.split(/[\/\\]+/).slice(-4, -1).join('/');
|
||||
return item;
|
||||
});
|
||||
|
||||
@ -58,8 +58,8 @@ function createIndexFile() {
|
||||
fileContent += `\nwindow.IonicNative = {\n`;
|
||||
fileContent += INJECTABLE_CLASSES.map(e => e.className).join(',\n');
|
||||
fileContent += '\n};\n';
|
||||
fileContent += `require('./core/bootstrap').checkReady();\n`;
|
||||
fileContent += `require('./core/ng1').initAngular1(window.IonicNative);`;
|
||||
fileContent += `require('./@ionic-native/core/bootstrap').checkReady();\n`;
|
||||
fileContent += `require('./@ionic-native/core/ng1').initAngular1(window.IonicNative);`;
|
||||
|
||||
fs.writeFileSync(INDEX_PATH, fileContent, { encoding: 'utf-8' });
|
||||
}
|
||||
@ -68,7 +68,7 @@ function compile() {
|
||||
webpack(webpackConfig, (err, stats) => {
|
||||
if (err) console.log(err);
|
||||
else console.log(stats);
|
||||
// cleanEmittedData();
|
||||
cleanEmittedData();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -17,10 +17,10 @@
|
||||
"sourceMap": true
|
||||
},
|
||||
"include": [
|
||||
"src/core/**/*.ts"
|
||||
"src/@ionic-native/core/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"src/core/**/*.spec.ts"
|
||||
"src/@ionic-native/core/**/*.spec.ts"
|
||||
]
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"paths": {
|
||||
"@ionic-native/core": ["./dist/core"]
|
||||
"@ionic-native/core": ["./dist/@ionic-native/core"]
|
||||
},
|
||||
"outDir": "./dist",
|
||||
"rootDir": "src",
|
||||
@ -20,7 +20,7 @@
|
||||
"inlineSourceMap": true
|
||||
},
|
||||
"include": [
|
||||
"src/plugins/**/*.ts"
|
||||
"src/@ionic-native/plugins/**/*.ts"
|
||||
],
|
||||
"angularCompilerOptions": {
|
||||
"genDir": "aot"
|
||||
|
Loading…
Reference in New Issue
Block a user