typespeed 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scaffold/command.d.ts +1 -0
- package/dist/scaffold/command.js +34 -0
- package/dist/scaffold/command.js.map +1 -0
- package/dist/scaffold/templates/front-page.class.ts.tpl +12 -0
- package/dist/scaffold/templates/main.ts.tpl +13 -0
- package/dist/scaffold/templates/nodemon.json.tpl +7 -0
- package/dist/scaffold/templates/package.json.tpl +15 -0
- package/dist/scaffold/templates/tsconfig.json.tpl +20 -0
- package/package.json +7 -3
- package/src/scaffold/command.ts +38 -0
- package/src/scaffold/templates/front-page.class.ts.tpl +12 -0
- package/src/scaffold/templates/main.ts.tpl +13 -0
- package/src/scaffold/templates/nodemon.json.tpl +7 -0
- package/src/scaffold/templates/package.json.tpl +15 -0
- package/src/scaffold/templates/tsconfig.json.tpl +20 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const commander_1 = require("commander");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
commander_1.program.command('new [appName]')
|
|
6
|
+
.description('Create a new app.')
|
|
7
|
+
.action((appName) => {
|
|
8
|
+
const currentDir = process.cwd();
|
|
9
|
+
fs.mkdirSync(currentDir + "/" + appName);
|
|
10
|
+
mkFile("nodemon.json", currentDir + "/" + appName, appName);
|
|
11
|
+
mkFile("package.json", currentDir + "/" + appName, appName);
|
|
12
|
+
mkFile("tsconfig.json", currentDir + "/" + appName, appName);
|
|
13
|
+
fs.mkdirSync(currentDir + "/" + appName + "/src");
|
|
14
|
+
mkFile("main.ts", currentDir + "/" + appName + "/src", appName);
|
|
15
|
+
mkFile("front-page.class.ts", currentDir + "/" + appName + "/src", appName);
|
|
16
|
+
console.log('');
|
|
17
|
+
console.log(' Create app success!');
|
|
18
|
+
console.log('');
|
|
19
|
+
console.log(' Please run `npm install` in the app directory.');
|
|
20
|
+
console.log('');
|
|
21
|
+
});
|
|
22
|
+
commander_1.program.on('--help', () => {
|
|
23
|
+
console.log('');
|
|
24
|
+
console.log(' Examples:');
|
|
25
|
+
console.log('');
|
|
26
|
+
console.log(' $ speed new blog');
|
|
27
|
+
});
|
|
28
|
+
commander_1.program.parse(process.argv);
|
|
29
|
+
function mkFile(fileName, targetPath, appName) {
|
|
30
|
+
const tplPath = __dirname + "/templates";
|
|
31
|
+
const fileContents = fs.readFileSync(tplPath + "/" + fileName + ".tpl", "utf-8");
|
|
32
|
+
fs.writeFileSync(targetPath + "/" + fileName, fileContents.replace("###appName###", appName));
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/scaffold/command.ts"],"names":[],"mappings":";;AAAA,yCAAoC;AACpC,yBAAyB;AAEzB,mBAAO,CAAC,OAAO,CAAC,eAAe,CAAC;KAC3B,WAAW,CAAC,mBAAmB,CAAC;KAChC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;IAChB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAEjC,EAAE,CAAC,SAAS,CAAC,UAAU,GAAG,GAAG,GAAG,OAAO,CAAC,CAAC;IACzC,MAAM,CAAC,cAAc,EAAE,UAAU,GAAG,GAAG,GAAG,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5D,MAAM,CAAC,cAAc,EAAE,UAAU,GAAG,GAAG,GAAG,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5D,MAAM,CAAC,eAAe,EAAE,UAAU,GAAG,GAAG,GAAG,OAAO,EAAE,OAAO,CAAC,CAAC;IAE7D,EAAE,CAAC,SAAS,CAAC,UAAU,GAAG,GAAG,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;IAClD,MAAM,CAAC,SAAS,EA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|
4
|
+
"scripts": {
|
|
5
|
+
"watch": "nodemon",
|
|
6
|
+
"test": "ts-node src/main.ts",
|
|
7
|
+
"start": "ts-node --transpile-only src/main.ts",
|
|
8
|
+
"build": "tsc -p ."
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@types/node": "^18.0.6",
|
|
12
|
+
"tracer": "^1.1.6",
|
|
13
|
+
"typespeed": "latest"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "CommonJS",
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"emitDecoratorMetadata": true,
|
|
6
|
+
"experimentalDecorators": true,
|
|
7
|
+
"allowSyntheticDefaultImports": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"target": "ES2017",
|
|
10
|
+
"sourceMap": true,
|
|
11
|
+
"outDir": "./dist",
|
|
12
|
+
"baseUrl": "./",
|
|
13
|
+
"typeRoots": [
|
|
14
|
+
"node_modules/@types"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"include": [
|
|
18
|
+
"./src/**/*.ts"
|
|
19
|
+
]
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typespeed",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "A new Framework for TypeScript.",
|
|
5
5
|
"author": "speedphp",
|
|
6
6
|
"license": "MIT License",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc -p .",
|
|
9
|
-
"postbuild": "cp -r src/default/pages dist/default/pages",
|
|
9
|
+
"postbuild": "cp -r src/default/pages dist/default/pages && cp -r src/scaffold/templates dist/scaffold/templates",
|
|
10
10
|
"prebuild": "rm -rf dist",
|
|
11
11
|
"prepare": "npm version patch && npm run build",
|
|
12
12
|
"upgrade": "npm version minor",
|
|
13
13
|
"postpublish": "git push && git push --tags"
|
|
14
14
|
},
|
|
15
15
|
"main": "dist/typespeed.js",
|
|
16
|
+
"bin": {
|
|
17
|
+
"typespeed": "./dist/scaffold/command.js"
|
|
18
|
+
},
|
|
16
19
|
"homepage": "https://github.com/speedphp/typespeed#readme",
|
|
17
20
|
"repository": {
|
|
18
21
|
"type": "git",
|
|
@@ -39,6 +42,7 @@
|
|
|
39
42
|
"node-cache": "^5.1.2",
|
|
40
43
|
"ioredis": "^5.2.3",
|
|
41
44
|
"connect-redis": "^6.1.3",
|
|
42
|
-
"cron": "^2.1.0"
|
|
45
|
+
"cron": "^2.1.0",
|
|
46
|
+
"commander": "^9.4.0"
|
|
43
47
|
}
|
|
44
48
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { program } from "commander";
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
|
|
4
|
+
program.command('new [appName]')
|
|
5
|
+
.description('Create a new app.')
|
|
6
|
+
.action((appName) => {
|
|
7
|
+
const currentDir = process.cwd();
|
|
8
|
+
|
|
9
|
+
fs.mkdirSync(currentDir + "/" + appName);
|
|
10
|
+
mkFile("nodemon.json", currentDir + "/" + appName, appName);
|
|
11
|
+
mkFile("package.json", currentDir + "/" + appName, appName);
|
|
12
|
+
mkFile("tsconfig.json", currentDir + "/" + appName, appName);
|
|
13
|
+
|
|
14
|
+
fs.mkdirSync(currentDir + "/" + appName + "/src");
|
|
15
|
+
mkFile("main.ts", currentDir + "/" + appName + "/src", appName);
|
|
16
|
+
mkFile("front-page.class.ts", currentDir + "/" + appName + "/src", appName);
|
|
17
|
+
|
|
18
|
+
console.log('');
|
|
19
|
+
console.log(' Create app success!');
|
|
20
|
+
console.log('');
|
|
21
|
+
console.log(' Please run `npm install` in the app directory.');
|
|
22
|
+
console.log('');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
program.on('--help', () => {
|
|
26
|
+
console.log('');
|
|
27
|
+
console.log(' Examples:');
|
|
28
|
+
console.log('');
|
|
29
|
+
console.log(' $ speed new blog');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
program.parse(process.argv);
|
|
33
|
+
|
|
34
|
+
function mkFile(fileName, targetPath, appName) {
|
|
35
|
+
const tplPath = __dirname + "/templates";
|
|
36
|
+
const fileContents = fs.readFileSync(tplPath + "/" + fileName + ".tpl", "utf-8");
|
|
37
|
+
fs.writeFileSync(targetPath + "/" + fileName, fileContents.replace("###appName###", appName));
|
|
38
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "###appName###",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"watch": "nodemon",
|
|
6
|
+
"test": "ts-node src/main.ts",
|
|
7
|
+
"start": "ts-node --transpile-only src/main.ts",
|
|
8
|
+
"build": "tsc -p ."
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@types/node": "^18.0.6",
|
|
12
|
+
"tracer": "^1.1.6",
|
|
13
|
+
"typespeed": "latest"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "CommonJS",
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"emitDecoratorMetadata": true,
|
|
6
|
+
"experimentalDecorators": true,
|
|
7
|
+
"allowSyntheticDefaultImports": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"target": "ES2017",
|
|
10
|
+
"sourceMap": true,
|
|
11
|
+
"outDir": "./dist",
|
|
12
|
+
"baseUrl": "./",
|
|
13
|
+
"typeRoots": [
|
|
14
|
+
"node_modules/@types"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"include": [
|
|
18
|
+
"./src/**/*.ts"
|
|
19
|
+
]
|
|
20
|
+
}
|