@nimbus-ds/scripts 1.6.0-rc.5 → 1.6.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  This package is intended for internal use in generating custom script builds at design system build time.
4
4
 
5
+ ## 2025-03-18 `1.6.0`
6
+
7
+ #### 🎉 New features
8
+
9
+ - Improved ComponentBuilder flexibility to support generic usage, including Nimbus Patterns. ([#276](https://github.com/TiendaNube/nimbus-design-system/pull/276) by [@joacotornello](https://github.com/joacotornello))
10
+
11
+ ### 💡 Others
12
+
13
+ - Rebuild after build process changes to add support for modular imports and Server Components. ([#276](https://github.com/TiendaNube/nimbus-design-system/pull/276) by [@joacotornello](https://github.com/joacotornello))
14
+
15
+ ## 2025-03-07 `1.5.0`
16
+
17
+ #### 🐛 Bug fixes
18
+
19
+ - Docgen process won't break if some of the builds fails in between ([#272](https://github.com/TiendaNube/nimbus-design-system/pull/272) by [@joacotornello](https://github.com/joacotornello))
20
+
5
21
  ## 2023-07-07 `1.4.0`
6
22
 
7
23
  #### 🎉 New features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nimbus-ds/scripts",
3
- "version": "1.6.0-rc.5",
3
+ "version": "1.6.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -26,6 +26,5 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "typescript": "^4.9.3"
29
- },
30
- "stableVersion": "1.5.0"
29
+ }
31
30
  }
@@ -1,5 +0,0 @@
1
- export declare class ComponentsBuilder {
2
- private PATH;
3
- private getComponentsFrom;
4
- exec(): void;
5
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ComponentsBuilder = void 0;
4
- const tslib_1 = require("tslib");
5
- const fs_1 = tslib_1.__importDefault(require("fs"));
6
- const packageBuilder_1 = require("../packageBuilder");
7
- class ComponentsBuilder {
8
- PATH = "./packages/react/src/";
9
- getComponentsFrom(path) {
10
- const components = [];
11
- const atomicComponents = fs_1.default.readdirSync(`${this.PATH}/${path}`);
12
- for (const atomicComponent of atomicComponents) {
13
- const packageJsonContent = fs_1.default.readFileSync(`${this.PATH}/${path}/${atomicComponent}/package.json`, "utf-8");
14
- const json = JSON.parse(packageJsonContent);
15
- const componentName = json.name;
16
- components.push(componentName);
17
- }
18
- return components;
19
- }
20
- exec() {
21
- const atomicComponents = this.getComponentsFrom("atomic");
22
- const compositeComponents = this.getComponentsFrom("composite");
23
- const componentsCommand = [...atomicComponents, ...compositeComponents]
24
- .map((component) => `--filter=${component}`)
25
- .join(" ");
26
- new packageBuilder_1.PackageBuilder().execCommand(`turbo run build ${componentsCommand}`);
27
- }
28
- }
29
- exports.ComponentsBuilder = ComponentsBuilder;
30
- //# sourceMappingURL=ComponentsBuilder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComponentsBuilder.js","sourceRoot":"","sources":["../../src/componentsBuilder/ComponentsBuilder.ts"],"names":[],"mappings":";;;;AAAA,oDAAoB;AACpB,sDAAmD;AAEnD,MAAa,iBAAiB;IACpB,IAAI,GAAG,uBAAuB,CAAC;IAE/B,iBAAiB,CAAC,IAAY;QACpC,MAAM,UAAU,GAAG,EAAE,CAAC;QACtB,MAAM,gBAAgB,GAAG,YAAE,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;QAChE,KAAK,MAAM,eAAe,IAAI,gBAAgB,EAAE;YAC9C,MAAM,kBAAkB,GAAG,YAAE,CAAC,YAAY,CACxC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,IAAI,eAAe,eAAe,EACtD,OAAO,CACR,CAAC;YACF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;YAC5C,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC;YAChC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAChC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAEM,IAAI;QACT,MAAM,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC1D,MAAM,mBAAmB,GAAG,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;QAEhE,MAAM,iBAAiB,GAAG,CAAC,GAAG,gBAAgB,EAAE,GAAG,mBAAmB,CAAC;aACpE,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,YAAY,SAAS,EAAE,CAAC;aAC3C,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb,IAAI,+BAAc,EAAE,CAAC,WAAW,CAAC,mBAAmB,iBAAiB,EAAE,CAAC,CAAC;IAC3E,CAAC;CACF;AA5BD,8CA4BC"}
@@ -1 +0,0 @@
1
- export * from "./ComponentsBuilder";
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./ComponentsBuilder"), exports);
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/componentsBuilder/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC"}
@@ -1,31 +0,0 @@
1
- import * as TJS from "typescript-json-schema";
2
- import { DocgenOptions, Paths } from "./docgen.types";
3
- export declare class Docgen {
4
- private program;
5
- private options;
6
- private generator;
7
- private paths;
8
- private component;
9
- static defaultOptions: {
10
- settings: Partial<TJS.Args>;
11
- compilerOptions: Omit<TJS.CompilerOptions, "jsx"> & {
12
- jsx: string;
13
- };
14
- interfaceNames: string[];
15
- };
16
- constructor(options?: DocgenOptions);
17
- generate(paths: Paths): void;
18
- private createDoc;
19
- private formatProps;
20
- private getSchema;
21
- private getSource;
22
- private getComponentName;
23
- private getPackageName;
24
- private getVersion;
25
- private generateDocLink;
26
- private getPolymorphicProps;
27
- private getComponentId;
28
- private getSubComponentsNames;
29
- private getComponentPath;
30
- private getSubComponents;
31
- }
@@ -1,194 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Docgen = void 0;
4
- const tslib_1 = require("tslib");
5
- const path_1 = tslib_1.__importDefault(require("path"));
6
- const TJS = tslib_1.__importStar(require("typescript-json-schema"));
7
- const fs_1 = require("fs");
8
- const change_case_1 = require("change-case");
9
- const docgen_definitions_1 = require("./docgen.definitions");
10
- /* eslint no-console: "off" */
11
- class Docgen {
12
- program;
13
- options = {};
14
- generator = null;
15
- paths = { components: [], subComponents: [] };
16
- component = {
17
- id: "",
18
- name: "",
19
- path: "",
20
- source: "",
21
- sourcePackage: "",
22
- };
23
- static defaultOptions = {
24
- settings: docgen_definitions_1.defaultSettings,
25
- compilerOptions: docgen_definitions_1.defaultCompilerOptions,
26
- interfaceNames: ["Properties"],
27
- };
28
- constructor(options = {}) {
29
- // Applying user-specified options over the default options
30
- // and making merged options further available to the plugin methods.
31
- // You should probably validate all the options here as well.
32
- this.options = { ...Docgen.defaultOptions, ...options };
33
- }
34
- generate(paths) {
35
- this.paths = { ...this.paths, ...paths };
36
- // Building compiler for sent paths
37
- console.log("Building compiler for sent paths...");
38
- const allPaths = [...paths.components, ...(paths?.subComponents ?? [])];
39
- this.program = TJS.getProgramFromFiles(allPaths.map((path) => path_1.default.resolve(path)), this.options.compilerOptions);
40
- this.generator = TJS.buildGenerator(this.program, this.options.settings);
41
- // Building documentation
42
- this.paths.components.forEach((path) => {
43
- this.createDoc(path);
44
- });
45
- console.log("Done!");
46
- }
47
- createDoc(path) {
48
- console.log(`Creating doc for ${path}...`);
49
- this.component.name = this.getComponentName(path);
50
- this.component.path = this.getComponentPath(path);
51
- this.component.id = this.getComponentId();
52
- this.component.source = this.getSource(`${this.component.path}/${this.component.name}.tsx`);
53
- this.component.sourcePackage = this.getSource(`${this.component.path.replace(`${this.component.name}/src`, this.component.name)}/package.json`);
54
- const polymorphicProps = this.getPolymorphicProps();
55
- const schema = this.getSchema(
56
- // this.getComponentInterfaceNames(this.component.name)
57
- `${this.component.name}Properties`);
58
- const props = this.formatProps(schema, polymorphicProps);
59
- const packageName = this.getPackageName();
60
- const version = this.getVersion();
61
- const docLink = this.generateDocLink();
62
- const subComponents = this.getSubComponents();
63
- const doc = {
64
- id: this.component.id,
65
- name: this.component.name,
66
- totalProps: props.length,
67
- packageName,
68
- version,
69
- docLink,
70
- props,
71
- subComponents,
72
- };
73
- const dist = `${this.component.path}/${this.component.id}.docs.json`;
74
- (0, fs_1.writeFileSync)(dist, JSON.stringify(doc, null, 2));
75
- console.log(`created ${dist} ✅`);
76
- }
77
- formatProps(schema, polymorphicProps) {
78
- const props = Object.keys(schema?.properties ?? {}).reduce((prev, curr) => {
79
- const property = schema?.properties?.[curr];
80
- const isRequired = schema?.required
81
- ? schema?.required?.indexOf(curr) !== -1
82
- : false;
83
- if (property)
84
- prev.push({ ...property, required: isRequired });
85
- return prev;
86
- }, []);
87
- if (!!polymorphicProps?.length) {
88
- const asDefault = this.component.source.match(/As = "(\w+)",/m)?.[1] ?? "";
89
- props.unshift({
90
- default: asDefault,
91
- description: "The underlying element to render — either a HTML element name or a React component.",
92
- anyOf: [
93
- {
94
- enum: polymorphicProps,
95
- type: "string",
96
- },
97
- {
98
- type: "React.ElementType",
99
- },
100
- ],
101
- title: "as",
102
- required: false,
103
- });
104
- }
105
- return props;
106
- }
107
- getSchema(fullTypeName) {
108
- try {
109
- const schema = TJS.generateSchema(this.program, fullTypeName, this.options.settings, [], this.generator ?? undefined);
110
- if (!schema) {
111
- throw new Error(`Schema not found for ${fullTypeName}`);
112
- }
113
- return schema;
114
- }
115
- catch (error) {
116
- console.log(`Error generating the schema for ${fullTypeName}`, error);
117
- return {};
118
- }
119
- }
120
- // private getSchema(interfaceTypeNames: string[]): TJS.Definition {
121
- // for (const [i, name] of interfaceTypeNames.entries()) {
122
- // try {
123
- // const schema = TJS.generateSchema(
124
- // this.program,
125
- // name,
126
- // this.options.settings,
127
- // [],
128
- // this.generator ?? undefined
129
- // );
130
- // if (schema) return schema;
131
- // } catch (error) {
132
- // if (i >= interfaceTypeNames.length - 1) {
133
- // // If the error is the last interface name try, log it
134
- // console.log(`Error generating the schema for ${name}`, error);
135
- // }
136
- // continue;
137
- // }
138
- // }
139
- // return {};
140
- // }
141
- getSource(path) {
142
- return (0, fs_1.readFileSync)(path, "utf8");
143
- }
144
- getComponentName(path) {
145
- const regex = RegExp("(\\w+)\\.types\\.ts", "gm");
146
- const fullPatch = regex.exec(path)?.[0] ?? "";
147
- return (0, change_case_1.pascalCase)(fullPatch.replace(".types.ts", ""));
148
- }
149
- getPackageName() {
150
- const regex = RegExp('"name": "(.+)"', "m");
151
- return regex.exec(this.component.sourcePackage)?.[1] ?? "";
152
- }
153
- getVersion() {
154
- const regex = RegExp('"version": "(.+)"', "m");
155
- return regex.exec(this.component.sourcePackage)?.[1] ?? "";
156
- }
157
- generateDocLink() {
158
- const context = this.component.path.split("/")?.[3] || "";
159
- return `https://nimbus.nuvemshop.com.br/documentation/${context}-components/${(0, change_case_1.paramCase)(this.component.id)}`;
160
- }
161
- getPolymorphicProps() {
162
- const regex = RegExp("PolymorphicForwardRefComponent<(.+),.+> &$", "m");
163
- const match = regex.exec(this.component.source)?.[1] ?? "";
164
- return match ? match.replace(/[" ]/gm, "").split("|") : [];
165
- }
166
- getComponentId() {
167
- return (0, change_case_1.camelCase)(this.component.name);
168
- }
169
- getSubComponentsNames() {
170
- return Array.from(this.component.source.matchAll(/^\w+\.\w+\.displayName =\n?.+"(.+)";/gm), (m) => m[1]);
171
- }
172
- getComponentPath(path) {
173
- return path.match(/([A-z\/]+src)/gm)?.[0] ?? "";
174
- }
175
- getSubComponents() {
176
- const subComponentsNames = this.getSubComponentsNames();
177
- const subComponents = subComponentsNames.reduce((prev, curr) => {
178
- const subComponent = curr.replace(".", "");
179
- const schema = this.getSchema(
180
- // this.getComponentInterfaceNames(subComponent)
181
- `${subComponent}Properties`);
182
- const props = this.formatProps(schema);
183
- prev.push({
184
- name: curr,
185
- totalProps: props.length,
186
- props,
187
- });
188
- return prev;
189
- }, []);
190
- return subComponents;
191
- }
192
- }
193
- exports.Docgen = Docgen;
194
- //# sourceMappingURL=Docgen.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Docgen.js","sourceRoot":"","sources":["../../src/docgen/Docgen.ts"],"names":[],"mappings":";;;;AAAA,wDAA4B;AAC5B,oEAA8C;AAC9C,2BAAiD;AACjD,6CAA+D;AAC/D,6DAA+E;AAG/E,8BAA8B;AAC9B,MAAa,MAAM;IACT,OAAO,CAAe;IAEtB,OAAO,GAAkB,EAAE,CAAC;IAE5B,SAAS,GAAmC,IAAI,CAAC;IAEjD,KAAK,GAAU,EAAE,UAAU,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC;IAErD,SAAS,GAAG;QAClB,EAAE,EAAE,EAAE;QACN,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,EAAE;QACV,aAAa,EAAE,EAAE;KAClB,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG;QACtB,QAAQ,EAAE,oCAAe;QACzB,eAAe,EAAE,2CAAsB;QACvC,cAAc,EAAE,CAAC,YAAY,CAAC;KAC/B,CAAC;IAEF,YAAY,UAAyB,EAAE;QACrC,2DAA2D;QAC3D,qEAAqE;QACrE,6DAA6D;QAE7D,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,MAAM,CAAC,cAAc,EAAE,GAAG,OAAO,EAAE,CAAC;IAC1D,CAAC;IAEM,QAAQ,CAAC,KAAY;QAC1B,IAAI,CAAC,KAAK,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC;QAEzC,mCAAmC;QACnC,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;QACnD,MAAM,QAAQ,GAAG,C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AG,kBAAkB,CAAC,MAAM,CAAC,CAAC,IAAW,EAAE,IAAI,EAAE,EAAE;YACpE,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAE3C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS;YAC3B,gDAAgD;YAChD,GAAG,YAAY,YAAY,CAC5B,CAAC;YAEF,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAEvC,IAAI,CAAC,IAAI,CAAC;gBACR,IAAI,EAAE,IAAI;gBACV,UAAU,EAAE,KAAK,CAAC,MAAM;gBACxB,KAAK;aACN,CAAC,CAAC;YACH,OAAO,IAAI,CAAC;QACd,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,aAAa,CAAC;IACvB,CAAC;;AA5PH,wBAuQC"}
@@ -1,5 +0,0 @@
1
- import { PartialArgs, CompilerOptions } from "typescript-json-schema";
2
- export declare const defaultSettings: PartialArgs;
3
- export declare const defaultCompilerOptions: Omit<CompilerOptions, "jsx"> & {
4
- jsx: string;
5
- };
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultCompilerOptions = exports.defaultSettings = void 0;
4
- exports.defaultSettings = {
5
- required: true,
6
- ref: false,
7
- noExtraProps: true,
8
- titles: true,
9
- propOrder: true,
10
- };
11
- exports.defaultCompilerOptions = {
12
- strictNullChecks: true,
13
- esModuleInterop: true,
14
- jsx: "react",
15
- };
16
- //# sourceMappingURL=docgen.definitions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docgen.definitions.js","sourceRoot":"","sources":["../../src/docgen/docgen.definitions.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAgB;IAC1C,QAAQ,EAAE,IAAI;IACd,GAAG,EAAE,KAAK;IACV,YAAY,EAAE,IAAI;IAClB,MAAM,EAAE,IAAI;IACZ,SAAS,EAAE,IAAI;CAChB,CAAC;AAEW,QAAA,sBAAsB,GAE/B;IACF,gBAAgB,EAAE,IAAI;IACtB,eAAe,EAAE,IAAI;IACrB,GAAG,EAAE,OAAO;CACb,CAAC"}
@@ -1,26 +0,0 @@
1
- import { PartialArgs, CompilerOptions } from "typescript-json-schema";
2
- export interface Prop {
3
- title: string;
4
- description: string;
5
- default?: string;
6
- required: boolean;
7
- type?: string;
8
- enum?: string[];
9
- anyOf?: {};
10
- }
11
- export interface Doc {
12
- name: string;
13
- totalProps: number;
14
- props?: Prop[];
15
- }
16
- export interface Paths {
17
- components: string[];
18
- subComponents?: string[];
19
- }
20
- export interface DocgenOptions {
21
- settings?: PartialArgs;
22
- compilerOptions?: Omit<CompilerOptions, "jsx"> & {
23
- jsx: string;
24
- };
25
- interfaceNames?: string[];
26
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=docgen.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docgen.types.js","sourceRoot":"","sources":["../../src/docgen/docgen.types.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export { defaultCompilerOptions as defaultCompilerOptionsDocgen } from "./docgen.definitions";
2
- export type { DocgenOptions } from "./docgen.types";
3
- export * from "./Docgen";
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultCompilerOptionsDocgen = void 0;
4
- const tslib_1 = require("tslib");
5
- var docgen_definitions_1 = require("./docgen.definitions");
6
- Object.defineProperty(exports, "defaultCompilerOptionsDocgen", { enumerable: true, get: function () { return docgen_definitions_1.defaultCompilerOptions; } });
7
- tslib_1.__exportStar(require("./Docgen"), exports);
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/docgen/index.ts"],"names":[],"mappings":";;;;AAAA,2DAA8F;AAArF,kIAAA,sBAAsB,OAAgC;AAE/D,mDAAyB"}
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from "./docgen";
2
- export * from "./packageBuilder";
3
- export * from "./componentsBuilder";
package/dist/index.js DELETED
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./docgen"), exports);
5
- tslib_1.__exportStar(require("./packageBuilder"), exports);
6
- tslib_1.__exportStar(require("./componentsBuilder"), exports);
7
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB;AACzB,2DAAiC;AACjC,8DAAoC"}
@@ -1,10 +0,0 @@
1
- export declare class PackageBuilder {
2
- getPackagesToBuild(path: string): string[];
3
- private processVersions;
4
- getCommandBuildNPM(packages: string[], removePackages?: string[]): string;
5
- execCommand(command: string): void;
6
- triggerBuildGithubAction(url: string, body: {
7
- [key: string]: string;
8
- }): Promise<void>;
9
- private getContentVersions;
10
- }
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PackageBuilder = void 0;
4
- const tslib_1 = require("tslib");
5
- const fs_1 = tslib_1.__importDefault(require("fs"));
6
- const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
7
- const child_process_1 = require("child_process");
8
- /* eslint no-console: "off" */
9
- class PackageBuilder {
10
- getPackagesToBuild(path) {
11
- const content = this.getContentVersions(path);
12
- return this.processVersions(content);
13
- }
14
- processVersions(content) {
15
- const regex = /^ {2}"?([^":]+)"?:/gm;
16
- return Array.from(content.matchAll(regex), (match) => match[1].replace(/"/g, ""));
17
- }
18
- getCommandBuildNPM(packages, removePackages = []) {
19
- const filteredPackages = packages.filter((pack) => !removePackages.includes(pack));
20
- const removeFilters = removePackages
21
- .map((pack) => `--filter=!${pack}`)
22
- .join(" ");
23
- return filteredPackages.reduce((prev, curr) => {
24
- prev = prev + ` --filter=${curr}...`;
25
- return prev;
26
- }, `turbo run build ${removeFilters}`);
27
- }
28
- execCommand(command) {
29
- console.log(`\x1b[32m 🏃‍♂️ Running building packages... \x1b[0m`);
30
- (0, child_process_1.execSync)(command, { stdio: "inherit" });
31
- }
32
- async triggerBuildGithubAction(url, body) {
33
- try {
34
- if (!process.env.GITHUB_TOKEN) {
35
- throw new Error("You need to set an environment variable called GITHUB_TOKEN with your personal git token");
36
- }
37
- await (0, node_fetch_1.default)(url, {
38
- method: "POST",
39
- headers: {
40
- "Content-Type": "application/json",
41
- Authorization: `token ${process.env.GITHUB_TOKEN}`,
42
- },
43
- body: JSON.stringify(body),
44
- });
45
- console.log(`\x1b[32m 🏃‍♂️ Running building github action... \x1b[0m`);
46
- }
47
- catch (error) {
48
- throw new Error(`An error occurred while executing an action: ${error.message}`);
49
- }
50
- }
51
- getContentVersions(path) {
52
- try {
53
- return fs_1.default.readFileSync(path, "utf8");
54
- }
55
- catch (error) {
56
- throw new Error("The versions file was not found so it was not possible to perform the build...");
57
- }
58
- }
59
- }
60
- exports.PackageBuilder = PackageBuilder;
61
- //# sourceMappingURL=PackageBuilder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PackageBuilder.js","sourceRoot":"","sources":["../../src/packageBuilder/PackageBuilder.ts"],"names":[],"mappings":";;;;AAAA,oDAAoB;AACpB,oEAA+B;AAC/B,iDAAyC;AAEzC,8BAA8B;AAC9B,MAAa,cAAc;IAClB,kBAAkB,CAAC,IAAY;QACpC,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAEO,eAAe,CAAC,OAAe;QACrC,MAAM,KAAK,GAAG,sBAAsB,CAAC;QACrC,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CA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AC,IAAI,CAAC;aAC3B,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;SAC1E;QAAC,OAAO,KAAU,EAAE;YACnB,MAAM,IAAI,KAAK,CACb,gDAAgD,KAAK,CAAC,OAAO,EAAE,CAChE,CAAC;SACH;IACH,CAAC;IAEO,kBAAkB,CAAC,IAAY;QACrC,IAAI;YACF,OAAO,YAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;SACtC;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;SACH;IACH,CAAC;CACF;AAxED,wCAwEC"}
@@ -1 +0,0 @@
1
- export * from "./PackageBuilder";
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./PackageBuilder"), exports);
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/packageBuilder/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC"}