cli:update cli config

This commit is contained in:
pengfei.zhou 2020-01-07 14:03:07 +08:00 committed by osborn
parent 1ea382d8d5
commit 8fc72c95bc
12 changed files with 33 additions and 60 deletions

View File

@ -4,7 +4,12 @@ var program = require('commander');
program
.command('create <name>')
.option('-n, --native', 'Native')
.action(function (name, cmd) {
console.log('create ' + name + (cmd.native ? ' native' : 'js'))
require('./scripts/init')(name)
})
program
.command('new <name>')
.action(function (name, cmd) {
console.log('create ' + name + (cmd.native ? ' native' : 'js'))
require('./scripts/init')(name)

View File

@ -3,7 +3,7 @@ var path = require('path')
require('shelljs/global')
const targetJSPath = `${__dirname}/../target/js`
const targetJSPath = `${__dirname}/../target/`
const targetAndroidPath = `${__dirname}/../target/android`
const targetiOSPath = `${__dirname}/../target/iOS`
@ -65,14 +65,6 @@ function copyFolder(srcDir, tarDir, cb) {
}
function initJS(path, name) {
if (fs.existsSync(path)) {
console.warn(`Dir:${process.cwd()}/${path} already exists`)
return;
}
fs.mkdir(path, function (err) {
if (err) {
return console.error(err);
}
console.log(`create dir ${path} success`);
fs.writeFileSync(`${path}/package.json`, fs.readFileSync(`${targetJSPath}/_package.json`).toString().replace(/__\$__/g, name))
fs.writeFileSync(`${path}/tsconfig.json`, fs.readFileSync(`${targetJSPath}/_tsconfig.json`))
@ -87,7 +79,6 @@ function initJS(path, name) {
exec(`cd ${path} && npm install && npm run build`, () => {
console.log(`Create Doric JS Project Success`)
})
})
}
function initAndroid(path, name) {
if (fs.existsSync(path)) {
@ -133,7 +124,7 @@ module.exports = function (name) {
if (err) {
return console.error(err);
}
initJS(`${process.cwd()}/${name}/js`, name)
initJS(`${process.cwd()}/${name}`, name)
initAndroid(`${process.cwd()}/${name}/android`, name)
initiOS(`${process.cwd()}/${name}/iOS`, name)
})

View File

@ -1,7 +1,4 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{

View File

@ -10,7 +10,7 @@
},
"license": "Apache-2.0",
"dependencies": {
"doric": "0.2.1",
"doric": "0.2.3",
"reflect-metadata": "^0.1.13",
"rollup": "^1.27.14",
"@rollup/plugin-commonjs": "^11.0.0",

View File

@ -1,6 +1,4 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{

View File

@ -20,7 +20,7 @@ android {
sourceSets {
main {
assets.srcDirs = [project.getRootDir().getParent() + "/js/bundle"]
assets.srcDirs = [project.getRootDir().getParent() + "/bundle"]
}
}
@ -28,8 +28,8 @@ android {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "pub.doric:core:0.2.1"
debugImplementation "pub.doric:core:0.2.1"
implementation "pub.doric:core:0.2.3"
debugImplementation "pub.doric:core:0.2.3"
}
}
@ -38,6 +38,6 @@ afterEvaluate {
}
task buildJSBundle(type: Exec) {
workingDir project.rootDir.getParent() + "/js"
workingDir project.rootDir.getParent()
commandLine 'doric', 'build'
}

View File

@ -8,18 +8,19 @@
/* Begin PBXBuildFile section */
95EDDB7EAB47A65821DBC7EC /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB59FE64F1D814FD13C71BB2 /* Pods_Example.framework */; };
E2B059BF23C452BB007555C7 /* src in Resources */ = {isa = PBXBuildFile; fileRef = E2B059BE23C452BB007555C7 /* src */; };
E2F64CEF2399359C0006BD9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E2F64CEE2399359C0006BD9A /* AppDelegate.m */; };
E2F64CF22399359C0006BD9A /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E2F64CF12399359C0006BD9A /* SceneDelegate.m */; };
E2F64CFA2399359E0006BD9A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E2F64CF92399359E0006BD9A /* Assets.xcassets */; };
E2F64CFD2399359E0006BD9A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E2F64CFB2399359E0006BD9A /* LaunchScreen.storyboard */; };
E2F64D002399359E0006BD9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E2F64CFF2399359E0006BD9A /* main.m */; };
E2F64D07239936A70006BD9A /* src in Resources */ = {isa = PBXBuildFile; fileRef = E2F64D06239936A70006BD9A /* src */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
197D29BBE572343DDD72F8A6 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = "<group>"; };
5D47A9D4EA2836D57373FDF6 /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = "<group>"; };
AB59FE64F1D814FD13C71BB2 /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
E2B059BE23C452BB007555C7 /* src */ = {isa = PBXFileReference; lastKnownFileType = folder; name = src; path = ../bundle/src; sourceTree = "<group>"; };
E2F64CEA2399359C0006BD9A /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
E2F64CED2399359C0006BD9A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
E2F64CEE2399359C0006BD9A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
@ -29,7 +30,6 @@
E2F64CFC2399359E0006BD9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
E2F64CFE2399359E0006BD9A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E2F64CFF2399359E0006BD9A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
E2F64D06239936A70006BD9A /* src */ = {isa = PBXFileReference; lastKnownFileType = folder; name = src; path = ../js/bundle/src; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -56,7 +56,7 @@
E2F64CE12399359C0006BD9A = {
isa = PBXGroup;
children = (
E2F64D06239936A70006BD9A /* src */,
E2B059BE23C452BB007555C7 /* src */,
E2F64CEC2399359C0006BD9A /* Example */,
E2F64CEB2399359C0006BD9A /* Products */,
875E7B19E6A1ABA3F802B6B5 /* Pods */,
@ -102,13 +102,12 @@
isa = PBXNativeTarget;
buildConfigurationList = E2F64D032399359E0006BD9A /* Build configuration list for PBXNativeTarget "Example" */;
buildPhases = (
E2F64D0B2399FFB20006BD9A /* Package JS Bundle */,
8E2E7D30FF8381E7791EA41B /* [CP] Check Pods Manifest.lock */,
E2F64D0B2399FFB20006BD9A /* Package JS Bundle */,
E2F64CE62399359C0006BD9A /* Sources */,
E2F64CE72399359C0006BD9A /* Frameworks */,
E2F64CE82399359C0006BD9A /* Resources */,
489CC68D7F95811A10DFEC4E /* [CP] Embed Pods Frameworks */,
825E7E0BA78A39B2E522054D /* [CP] Copy Pods Resources */,
);
buildRules = (
);
@ -156,7 +155,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E2F64D07239936A70006BD9A /* src in Resources */,
E2B059BF23C452BB007555C7 /* src in Resources */,
E2F64CFD2399359E0006BD9A /* LaunchScreen.storyboard in Resources */,
E2F64CFA2399359E0006BD9A /* Assets.xcassets in Resources */,
);
@ -182,23 +181,6 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
825E7E0BA78A39B2E522054D /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
8E2E7D30FF8381E7791EA41B /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@ -237,7 +219,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n# Type a script or drag a script file from your workspace to insert its path.\n\nexport NVM_DIR=\"$HOME/.nvm\"\n[ -s \"$NVM_DIR/nvm.sh\" ] && \\. \"$NVM_DIR/nvm.sh\" # This loads nvm\n[ -s \"$NVM_DIR/bash_completion\" ] && \\. \"$NVM_DIR/bash_completion\" # This loads nvm bash_completion\n\ncd ../js && doric build\n";
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n# Type a script or drag a script file from your workspace to insert its path.\n\nexport NVM_DIR=\"$HOME/.nvm\"\n[ -s \"$NVM_DIR/nvm.sh\" ] && \\. \"$NVM_DIR/nvm.sh\" # This loads nvm\n[ -s \"$NVM_DIR/bash_completion\" ] && \\. \"$NVM_DIR/bash_completion\" # This loads nvm bash_completion\n\ncd ../ && doric build\n";
};
/* End PBXShellScriptBuildPhase section */

View File

@ -6,5 +6,5 @@ target 'Example' do
use_frameworks!
# Pods for Example
pod 'DoricCore', '~>0.2.1'
pod 'DoricCore', '~>0.2.3'
end