@webflow/webflow-cli 1.3.0 → 1.4.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 +6 -0
- package/dist/index.js +23 -16
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -229276,9 +229276,16 @@ var import_archiver = __toESM(require_archiver());
|
|
|
229276
229276
|
var prettyJson = (json) => JSON.stringify(json, null, 2);
|
|
229277
229277
|
var port = 1337;
|
|
229278
229278
|
var manifestFile = "webflow.json";
|
|
229279
|
-
var distDir = "public";
|
|
229280
229279
|
var uiFile = "index.html";
|
|
229281
229280
|
var bundleFile = "bundle.zip";
|
|
229281
|
+
var defaultPublicDir = "public";
|
|
229282
|
+
async function getConfig2() {
|
|
229283
|
+
const manifestConfig = await findConfig();
|
|
229284
|
+
return {
|
|
229285
|
+
filepath: manifestConfig.filepath,
|
|
229286
|
+
config: { publicDir: defaultPublicDir, ...manifestConfig.config }
|
|
229287
|
+
};
|
|
229288
|
+
}
|
|
229282
229289
|
var findConfig = async () => {
|
|
229283
229290
|
const configSearch = (0, import_cosmiconfig.cosmiconfig)("webflow", {
|
|
229284
229291
|
searchPlaces: [manifestFile]
|
|
@@ -229296,10 +229303,10 @@ var box = (str) => {
|
|
|
229296
229303
|
return "\u256D" + horiz + "\u256E\n\u2502 " + str + " \u2502\n\u2570" + horiz + "\u256F";
|
|
229297
229304
|
};
|
|
229298
229305
|
var serveExtension = async () => {
|
|
229299
|
-
const
|
|
229300
|
-
const uiPath = import_path.default.join(
|
|
229306
|
+
const { config, filepath } = await getConfig2();
|
|
229307
|
+
const uiPath = import_path.default.join(filepath, "..", config.publicDir, uiFile);
|
|
229301
229308
|
const templateRequest = await lib_default(
|
|
229302
|
-
"https://extensions.webflow.com/template?name=" +
|
|
229309
|
+
"https://extensions.webflow.com/template?name=" + config.name
|
|
229303
229310
|
);
|
|
229304
229311
|
const template = await templateRequest.text();
|
|
229305
229312
|
const server = new import_http2.default.Server((request, response) => {
|
|
@@ -229318,15 +229325,15 @@ var serveExtension = async () => {
|
|
|
229318
229325
|
}
|
|
229319
229326
|
if (request.url === "/__webflow") {
|
|
229320
229327
|
response.writeHead(200, {
|
|
229321
|
-
"Content-Length": Buffer.byteLength(prettyJson(
|
|
229328
|
+
"Content-Length": Buffer.byteLength(prettyJson(config)),
|
|
229322
229329
|
"Content-Type": "application/json",
|
|
229323
229330
|
"Access-Control-Allow-Origin": "*",
|
|
229324
229331
|
"Access-Control-Allow-Headers": "*"
|
|
229325
229332
|
});
|
|
229326
|
-
return response.end(prettyJson(
|
|
229333
|
+
return response.end(prettyJson(config));
|
|
229327
229334
|
}
|
|
229328
229335
|
(0, import_serve_handler.default)(request, response, {
|
|
229329
|
-
public:
|
|
229336
|
+
public: config.publicDir,
|
|
229330
229337
|
cleanUrls: false,
|
|
229331
229338
|
directoryListing: false
|
|
229332
229339
|
});
|
|
@@ -229403,8 +229410,8 @@ $ npm run dev
|
|
|
229403
229410
|
|
|
229404
229411
|
The above command does a few things:
|
|
229405
229412
|
* Installs dependencies
|
|
229406
|
-
* Watches for changes in the \`src/\` folder and recompiles your TypeScript files, outputting an \`index.js\` file under the \`${
|
|
229407
|
-
* Spins up a process that serves your extension files from under \`${
|
|
229413
|
+
* Watches for changes in the \`src/\` folder and recompiles your TypeScript files, outputting an \`index.js\` file under the \`${defaultPublicDir}/\` folder
|
|
229414
|
+
* Spins up a process that serves your extension files from under \`${defaultPublicDir}/\`
|
|
229408
229415
|
|
|
229409
229416
|
The command outputs the URL under which your extension is being served. Use this as the \u201CDevelopment URL\u201D for your app in the Webflow Designer\u2019s Apps panel. You can then launch the extension from the same place.
|
|
229410
229417
|
|
|
@@ -229422,7 +229429,7 @@ var initExtension = async (name) => {
|
|
|
229422
229429
|
await import_promises2.default.mkdir(dir2).catch((err) => {
|
|
229423
229430
|
import_commander.program.error(err.message);
|
|
229424
229431
|
});
|
|
229425
|
-
const distPath = import_path.default.join(dir2,
|
|
229432
|
+
const distPath = import_path.default.join(dir2, defaultPublicDir);
|
|
229426
229433
|
await import_promises2.default.mkdir(distPath);
|
|
229427
229434
|
await import_promises2.default.writeFile(
|
|
229428
229435
|
import_path.default.join(dir2, manifestFile),
|
|
@@ -229452,7 +229459,7 @@ var initExtension = async (name) => {
|
|
|
229452
229459
|
import_path.default.join(dir2, "tsconfig.json"),
|
|
229453
229460
|
prettyJson({
|
|
229454
229461
|
compilerOptions: {
|
|
229455
|
-
outDir:
|
|
229462
|
+
outDir: defaultPublicDir,
|
|
229456
229463
|
target: "es6",
|
|
229457
229464
|
lib: ["es6", "dom"],
|
|
229458
229465
|
typeRoots: ["./node_modules/@types", "./node_modules/@webflow"]
|
|
@@ -229469,10 +229476,10 @@ var initExtension = async (name) => {
|
|
|
229469
229476
|
);
|
|
229470
229477
|
};
|
|
229471
229478
|
var bundleExtension = async () => {
|
|
229472
|
-
const
|
|
229473
|
-
const cwd = import_path.default.join(
|
|
229479
|
+
const { config, filepath } = await getConfig2();
|
|
229480
|
+
const cwd = import_path.default.join(filepath, "..");
|
|
229474
229481
|
console.log(
|
|
229475
|
-
`Packaging the contents of the ${
|
|
229482
|
+
`Packaging the contents of the ${config.publicDir} folder into ${bundleFile}...`
|
|
229476
229483
|
);
|
|
229477
229484
|
return new Promise((resolve) => {
|
|
229478
229485
|
const archive = (0, import_archiver.default)("zip", { zlib: { level: 9 } });
|
|
@@ -229491,8 +229498,8 @@ var bundleExtension = async () => {
|
|
|
229491
229498
|
import_commander.program.error(err.message);
|
|
229492
229499
|
});
|
|
229493
229500
|
archive.pipe(output);
|
|
229494
|
-
archive.directory(import_path.default.join(cwd,
|
|
229495
|
-
archive.file(
|
|
229501
|
+
archive.directory(import_path.default.join(cwd, config.publicDir), false);
|
|
229502
|
+
archive.file(filepath, { name: manifestFile });
|
|
229496
229503
|
archive.finalize();
|
|
229497
229504
|
});
|
|
229498
229505
|
};
|