@webflow/webflow-cli 1.2.5 → 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 +12 -0
- package/dist/index.js +51 -70
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @webflow/webflow-cli
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- adds publicDir option to webflow.json
|
|
8
|
+
|
|
9
|
+
## 1.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Add the ability to serve manifest files from cli and include them in bundling.
|
|
14
|
+
|
|
3
15
|
## 1.2.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -2020,60 +2020,25 @@ var require_public_api = __commonJS({
|
|
|
2020
2020
|
var require_package2 = __commonJS({
|
|
2021
2021
|
"../../node_modules/prettier/package.json"(exports, module2) {
|
|
2022
2022
|
module2.exports = {
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
_inBundle: false,
|
|
2026
|
-
_integrity: "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
|
|
2027
|
-
_location: "/prettier",
|
|
2028
|
-
_phantomChildren: {},
|
|
2029
|
-
_requested: {
|
|
2030
|
-
type: "tag",
|
|
2031
|
-
registry: true,
|
|
2032
|
-
raw: "prettier@latest",
|
|
2033
|
-
name: "prettier",
|
|
2034
|
-
escapedName: "prettier",
|
|
2035
|
-
rawSpec: "latest",
|
|
2036
|
-
saveSpec: null,
|
|
2037
|
-
fetchSpec: "latest"
|
|
2038
|
-
},
|
|
2039
|
-
_requiredBy: [
|
|
2040
|
-
"#DEV:/"
|
|
2041
|
-
],
|
|
2042
|
-
_resolved: "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
|
|
2043
|
-
_shasum: "e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da",
|
|
2044
|
-
_spec: "prettier@latest",
|
|
2045
|
-
_where: "/Users/federico/source/webflow-cli",
|
|
2046
|
-
author: {
|
|
2047
|
-
name: "James Long"
|
|
2048
|
-
},
|
|
2049
|
-
bin: {
|
|
2050
|
-
prettier: "bin-prettier.js"
|
|
2051
|
-
},
|
|
2052
|
-
browser: "./standalone.js",
|
|
2053
|
-
bugs: {
|
|
2054
|
-
url: "https://github.com/prettier/prettier/issues"
|
|
2055
|
-
},
|
|
2056
|
-
bundleDependencies: false,
|
|
2057
|
-
deprecated: false,
|
|
2023
|
+
name: "prettier",
|
|
2024
|
+
version: "2.8.8",
|
|
2058
2025
|
description: "Prettier is an opinionated code formatter",
|
|
2026
|
+
bin: "./bin-prettier.js",
|
|
2027
|
+
repository: "prettier/prettier",
|
|
2028
|
+
funding: "https://github.com/prettier/prettier?sponsor=1",
|
|
2029
|
+
homepage: "https://prettier.io",
|
|
2030
|
+
author: "James Long",
|
|
2031
|
+
license: "MIT",
|
|
2032
|
+
main: "./index.js",
|
|
2033
|
+
browser: "./standalone.js",
|
|
2034
|
+
unpkg: "./standalone.js",
|
|
2059
2035
|
engines: {
|
|
2060
2036
|
node: ">=10.13.0"
|
|
2061
2037
|
},
|
|
2062
2038
|
files: [
|
|
2063
2039
|
"*.js",
|
|
2064
2040
|
"esm/*.mjs"
|
|
2065
|
-
]
|
|
2066
|
-
funding: "https://github.com/prettier/prettier?sponsor=1",
|
|
2067
|
-
homepage: "https://prettier.io",
|
|
2068
|
-
license: "MIT",
|
|
2069
|
-
main: "./index.js",
|
|
2070
|
-
name: "prettier",
|
|
2071
|
-
repository: {
|
|
2072
|
-
type: "git",
|
|
2073
|
-
url: "git+https://github.com/prettier/prettier.git"
|
|
2074
|
-
},
|
|
2075
|
-
unpkg: "./standalone.js",
|
|
2076
|
-
version: "2.8.8"
|
|
2041
|
+
]
|
|
2077
2042
|
};
|
|
2078
2043
|
}
|
|
2079
2044
|
});
|
|
@@ -229311,9 +229276,16 @@ var import_archiver = __toESM(require_archiver());
|
|
|
229311
229276
|
var prettyJson = (json) => JSON.stringify(json, null, 2);
|
|
229312
229277
|
var port = 1337;
|
|
229313
229278
|
var manifestFile = "webflow.json";
|
|
229314
|
-
var distDir = "public";
|
|
229315
229279
|
var uiFile = "index.html";
|
|
229316
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
|
+
}
|
|
229317
229289
|
var findConfig = async () => {
|
|
229318
229290
|
const configSearch = (0, import_cosmiconfig.cosmiconfig)("webflow", {
|
|
229319
229291
|
searchPlaces: [manifestFile]
|
|
@@ -229331,10 +229303,10 @@ var box = (str) => {
|
|
|
229331
229303
|
return "\u256D" + horiz + "\u256E\n\u2502 " + str + " \u2502\n\u2570" + horiz + "\u256F";
|
|
229332
229304
|
};
|
|
229333
229305
|
var serveExtension = async () => {
|
|
229334
|
-
const
|
|
229335
|
-
const uiPath = import_path.default.join(
|
|
229306
|
+
const { config, filepath } = await getConfig2();
|
|
229307
|
+
const uiPath = import_path.default.join(filepath, "..", config.publicDir, uiFile);
|
|
229336
229308
|
const templateRequest = await lib_default(
|
|
229337
|
-
"https://extensions.webflow.com/template?name=" +
|
|
229309
|
+
"https://extensions.webflow.com/template?name=" + config.name
|
|
229338
229310
|
);
|
|
229339
229311
|
const template = await templateRequest.text();
|
|
229340
229312
|
const server = new import_http2.default.Server((request, response) => {
|
|
@@ -229351,8 +229323,17 @@ var serveExtension = async () => {
|
|
|
229351
229323
|
});
|
|
229352
229324
|
return;
|
|
229353
229325
|
}
|
|
229326
|
+
if (request.url === "/__webflow") {
|
|
229327
|
+
response.writeHead(200, {
|
|
229328
|
+
"Content-Length": Buffer.byteLength(prettyJson(config)),
|
|
229329
|
+
"Content-Type": "application/json",
|
|
229330
|
+
"Access-Control-Allow-Origin": "*",
|
|
229331
|
+
"Access-Control-Allow-Headers": "*"
|
|
229332
|
+
});
|
|
229333
|
+
return response.end(prettyJson(config));
|
|
229334
|
+
}
|
|
229354
229335
|
(0, import_serve_handler.default)(request, response, {
|
|
229355
|
-
public:
|
|
229336
|
+
public: config.publicDir,
|
|
229356
229337
|
cleanUrls: false,
|
|
229357
229338
|
directoryListing: false
|
|
229358
229339
|
});
|
|
@@ -229405,17 +229386,16 @@ button:focus {
|
|
|
229405
229386
|
border-color: #1280EE;
|
|
229406
229387
|
}
|
|
229407
229388
|
`;
|
|
229408
|
-
var indexTs = `document.getElementById("lorem").onsubmit = (event) => {
|
|
229389
|
+
var indexTs = `document.getElementById("lorem").onsubmit = async (event) => {
|
|
229409
229390
|
event.preventDefault()
|
|
229410
|
-
webflow.getSelectedElement()
|
|
229411
|
-
|
|
229412
|
-
|
|
229413
|
-
|
|
229414
|
-
|
|
229415
|
-
|
|
229416
|
-
|
|
229417
|
-
|
|
229418
|
-
})
|
|
229391
|
+
const el = await webflow.getSelectedElement();
|
|
229392
|
+
if (el && el.textContent) {
|
|
229393
|
+
el.setTextContent(
|
|
229394
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do " +
|
|
229395
|
+
"eiusmod tempor incididunt ut labore et dolore magna aliqua."
|
|
229396
|
+
)
|
|
229397
|
+
el.save()
|
|
229398
|
+
}
|
|
229419
229399
|
}
|
|
229420
229400
|
`;
|
|
229421
229401
|
var readme = `
|
|
@@ -229430,8 +229410,8 @@ $ npm run dev
|
|
|
229430
229410
|
|
|
229431
229411
|
The above command does a few things:
|
|
229432
229412
|
* Installs dependencies
|
|
229433
|
-
* Watches for changes in the \`src/\` folder and recompiles your TypeScript files, outputting an \`index.js\` file under the \`${
|
|
229434
|
-
* 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}/\`
|
|
229435
229415
|
|
|
229436
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.
|
|
229437
229417
|
|
|
@@ -229449,7 +229429,7 @@ var initExtension = async (name) => {
|
|
|
229449
229429
|
await import_promises2.default.mkdir(dir2).catch((err) => {
|
|
229450
229430
|
import_commander.program.error(err.message);
|
|
229451
229431
|
});
|
|
229452
|
-
const distPath = import_path.default.join(dir2,
|
|
229432
|
+
const distPath = import_path.default.join(dir2, defaultPublicDir);
|
|
229453
229433
|
await import_promises2.default.mkdir(distPath);
|
|
229454
229434
|
await import_promises2.default.writeFile(
|
|
229455
229435
|
import_path.default.join(dir2, manifestFile),
|
|
@@ -229479,7 +229459,7 @@ var initExtension = async (name) => {
|
|
|
229479
229459
|
import_path.default.join(dir2, "tsconfig.json"),
|
|
229480
229460
|
prettyJson({
|
|
229481
229461
|
compilerOptions: {
|
|
229482
|
-
outDir:
|
|
229462
|
+
outDir: defaultPublicDir,
|
|
229483
229463
|
target: "es6",
|
|
229484
229464
|
lib: ["es6", "dom"],
|
|
229485
229465
|
typeRoots: ["./node_modules/@types", "./node_modules/@webflow"]
|
|
@@ -229496,10 +229476,10 @@ var initExtension = async (name) => {
|
|
|
229496
229476
|
);
|
|
229497
229477
|
};
|
|
229498
229478
|
var bundleExtension = async () => {
|
|
229499
|
-
const
|
|
229500
|
-
const cwd = import_path.default.join(
|
|
229479
|
+
const { config, filepath } = await getConfig2();
|
|
229480
|
+
const cwd = import_path.default.join(filepath, "..");
|
|
229501
229481
|
console.log(
|
|
229502
|
-
`Packaging the contents of the ${
|
|
229482
|
+
`Packaging the contents of the ${config.publicDir} folder into ${bundleFile}...`
|
|
229503
229483
|
);
|
|
229504
229484
|
return new Promise((resolve) => {
|
|
229505
229485
|
const archive = (0, import_archiver.default)("zip", { zlib: { level: 9 } });
|
|
@@ -229518,7 +229498,8 @@ var bundleExtension = async () => {
|
|
|
229518
229498
|
import_commander.program.error(err.message);
|
|
229519
229499
|
});
|
|
229520
229500
|
archive.pipe(output);
|
|
229521
|
-
archive.directory(import_path.default.join(cwd,
|
|
229501
|
+
archive.directory(import_path.default.join(cwd, config.publicDir), false);
|
|
229502
|
+
archive.file(filepath, { name: manifestFile });
|
|
229522
229503
|
archive.finalize();
|
|
229523
229504
|
});
|
|
229524
229505
|
};
|