create-squire-workspace 0.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/create-workspace.d.ts +6 -0
- package/create-workspace.js +37 -0
- package/create-workspace.js.map +1 -0
- package/package.json +11 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
import { SqFolderUtils, SqPathUtils, SqProcessManager } from "@code-squire/utils";
|
|
3
|
+
import { instance } from "@code-squire/ioc";
|
|
4
|
+
import { SqVirtualFileSystem } from "@code-squire/vfs";
|
|
5
|
+
const packagesToInstall = [
|
|
6
|
+
"@code-squire/ioc",
|
|
7
|
+
"@code-squire/feature-modules",
|
|
8
|
+
"@code-squire/squire",
|
|
9
|
+
"@code-squire/workspace"
|
|
10
|
+
];
|
|
11
|
+
export class CreateSquireSpace {
|
|
12
|
+
processManager = new SqProcessManager();
|
|
13
|
+
async create() {
|
|
14
|
+
const [name] = process.argv.slice(2);
|
|
15
|
+
if (!name)
|
|
16
|
+
throw new Error('Squire - Please pass a name for your squire space');
|
|
17
|
+
await this.processManager.execute(`npm install -g tsx`);
|
|
18
|
+
const workspacePath = SqPathUtils.normalize(`${process.cwd()}/${name}`);
|
|
19
|
+
SqFolderUtils.create(workspacePath);
|
|
20
|
+
process.chdir(workspacePath);
|
|
21
|
+
await this.processManager.execute(`npm install -D ${packagesToInstall.join(' ')}`);
|
|
22
|
+
}
|
|
23
|
+
async setup() {
|
|
24
|
+
const vfs = instance(SqVirtualFileSystem);
|
|
25
|
+
const root = vfs.createVirtualRoot(process.cwd());
|
|
26
|
+
const api = await root.virtualize();
|
|
27
|
+
const path = SqPathUtils.getCurrentPath(import.meta.url);
|
|
28
|
+
const currentPath = SqPathUtils.normalize(process.cwd());
|
|
29
|
+
api.generate(`${path}/blueprint`, currentPath, {});
|
|
30
|
+
const result = await root.save();
|
|
31
|
+
console.log('Result:', result);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const space = new CreateSquireSpace();
|
|
35
|
+
await space.create();
|
|
36
|
+
await space.setup();
|
|
37
|
+
//# sourceMappingURL=create-workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-workspace.js","sourceRoot":"","sources":["../../../../squire/create-workspace/src/create-workspace.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,iBAAiB,GAAa;IAClC,kBAAkB;IAClB,8BAA8B;IAC9B,qBAAqB;IACrB,wBAAwB;CACzB,CAAC;AAEF,MAAM,OAAO,iBAAiB;IACpB,cAAc,GAAG,IAAI,gBAAgB,EAAE,CAAC;IAEzC,KAAK,CAAC,MAAM;QACjB,MAAM,CAAE,IAAI,CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QAEhF,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACxD,MAAM,aAAa,GAAG,WAAW,CAAC,SAAS,CAAC,GAAI,OAAO,CAAC,GAAG,EAAG,IAAK,IAAK,EAAE,CAAC,CAAC;QAE5E,aAAa,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACpC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAE7B,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,kBAAmB,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAE,EAAE,CAAC,CAAC;IACvF,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,MAAM,GAAG,GAAG,QAAQ,CAAC,mBAA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