@webflow/webflow-cli 1.6.9 → 1.6.11

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.
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": [
3
+ "eslint:recommended",
4
+ "plugin:@typescript-eslint/eslint-recommended",
5
+ "plugin:@typescript-eslint/recommended"
6
+ ],
7
+ "parser": "@typescript-eslint/parser",
8
+ "parserOptions": {
9
+ "project": "./tsconfig.json"
10
+ },
11
+ "plugins": ["@typescript-eslint", "promise"],
12
+ "rules": {
13
+ "@typescript-eslint/explicit-function-return-type": "off",
14
+ "@typescript-eslint/no-explicit-any": "off",
15
+ "@typescript-eslint/no-floating-promises": "error",
16
+ "@typescript-eslint/no-misused-promises": [
17
+ "error",
18
+ { "checksVoidReturn": false }
19
+ ],
20
+ "@typescript-eslint/no-unused-vars": "error",
21
+ "no-async-promise-executor": "error",
22
+ "require-await": "error",
23
+ "promise/catch-or-return": "error"
24
+ }
25
+ }
@@ -9,9 +9,10 @@ $ npm run dev
9
9
  ```
10
10
 
11
11
  The above command does a few things:
12
- * Installs dependencies
13
- * Watches for changes in the `src/` folder and recompiles your TypeScript files, outputting an `index.js` file under the `public/` folder
14
- * Spins up a process that serves your extension files from under `public/`
12
+
13
+ - Installs dependencies
14
+ - Watches for changes in the `src/` folder and recompiles your TypeScript files, outputting an `index.js` file under the `public/` folder
15
+ - Spins up a process that serves your extension files from under `public/`
15
16
 
16
17
  The command outputs the URL under which your extension is being served. Use this as the “Development URL” for your app in the Webflow Designer’s Apps panel. You can then launch the extension from the same place.
17
18
 
@@ -5,11 +5,17 @@
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "build": "npm install && tsc -p tsconfig.json && webflow extension bundle",
8
- "dev": "npm install && concurrently -r \"webflow extension serve\" \"tsc -p tsconfig.json --watch --preserveWatchOutput\""
8
+ "dev": "npm install && concurrently -r \"webflow extension serve\" \"tsc -p tsconfig.json --watch --preserveWatchOutput\"",
9
+ "lint": "eslint . --ext .ts"
9
10
  },
10
11
  "devDependencies": {
11
- "@webflow/designer-extension-typings": "*",
12
- "concurrently": "*",
13
- "typescript": "*"
12
+ "@webflow/designer-extension-typings": "^0.2.0-beta.8",
13
+ "@typescript-eslint/eslint-plugin": "^7.7.0",
14
+ "@typescript-eslint/parser": "^7.7.0",
15
+ "eslint": "^8.5.7",
16
+ "concurrently": "^8.2.2",
17
+ "typescript": "^5.4.5",
18
+ "eslint-plugin-promise": "^6.1.1"
14
19
  }
15
20
  }
21
+
@@ -11,12 +11,11 @@ addButtonListeners();
11
11
 
12
12
  document.getElementById("extension-form").onsubmit = async (event) => {
13
13
  event.preventDefault();
14
-
15
14
  // Get the current selected Element
16
15
  const el = await webflow.getSelectedElement();
17
16
 
18
17
  // If styles can be set on the Element
19
- if (el && el.styles && el.configurable && el.children) {
18
+ if (el && el.styles && el.children) {
20
19
  //Get current element's style
21
20
  const currentStyle = await el.getStyles();
22
21
 
@@ -24,12 +23,10 @@ document.getElementById("extension-form").onsubmit = async (event) => {
24
23
  const emojiStyle = await createOrUseStyle("emoji-style");
25
24
 
26
25
  // Create a new element that will display the text-emoji
27
- const labelElement = await webflow.createDOM("span");
28
- labelElement.setStyles([...currentStyle, emojiStyle]);
29
- labelElement.setTextContent(selectedEmoji);
30
-
31
- el.setChildren([...el.getChildren(), labelElement]);
32
- await el.save();
26
+ const labelElement = await el.append(webflow.elementPresets.DOM);
27
+ await labelElement.setTag("span");
28
+ await labelElement.setStyles([...currentStyle, emojiStyle]);
29
+ await labelElement.setTextContent(selectedEmoji);
33
30
  } else {
34
31
  alert("Please select a text element");
35
32
  }
@@ -44,8 +41,8 @@ async function createOrUseStyle(styleName) {
44
41
  return style;
45
42
  } else {
46
43
  // Create a new style, return it
47
- const emojiStyle = webflow.createStyle(styleName);
48
- emojiStyle.setProperties({ "background-color": "#FF00FF" });
44
+ const emojiStyle = await webflow.createStyle(styleName);
45
+ await emojiStyle.setProperties({ "background-color": "#FF00FF" });
49
46
  return emojiStyle;
50
47
  }
51
48
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "wf-placeholder-name",
3
3
  "publicDir": "public",
4
- "size": "default"
4
+ "size": "default",
5
+ "apiVersion": "2"
5
6
  }
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": [
3
+ "eslint:recommended",
4
+ "plugin:@typescript-eslint/eslint-recommended",
5
+ "plugin:@typescript-eslint/recommended"
6
+ ],
7
+ "parser": "@typescript-eslint/parser",
8
+ "parserOptions": {
9
+ "project": "./tsconfig.json"
10
+ },
11
+ "plugins": ["@typescript-eslint", "promise"],
12
+ "rules": {
13
+ "@typescript-eslint/explicit-function-return-type": "off",
14
+ "@typescript-eslint/no-explicit-any": "off",
15
+ "@typescript-eslint/no-floating-promises": "error",
16
+ "@typescript-eslint/no-misused-promises": [
17
+ "error",
18
+ { "checksVoidReturn": false }
19
+ ],
20
+ "@typescript-eslint/no-unused-vars": "error",
21
+ "no-async-promise-executor": "error",
22
+ "require-await": "error",
23
+ "promise/catch-or-return": "error"
24
+ }
25
+ }
@@ -16,4 +16,4 @@ This command installs dependencies, watches for changes in the `src/` folder, an
16
16
  npm run build
17
17
  ```
18
18
 
19
- This command prepares a `${bundleFile}` in the `./dist/` folder. Upload this `bundle.zip` file for distributing the App inside of your workspace or via the Marketplace.
19
+ This command prepares a `${bundleFile}` in the `./dist/` folder. Upload this `bundle.zip` file for distributing the App inside of your workspace or via the Marketplace.
@@ -5,16 +5,27 @@
5
5
  "dev": "npm install && concurrently \"webflow extension serve\" \"npm run watch-webpack\"",
6
6
  "build": "npm run build-webpack && webflow extension bundle",
7
7
  "watch-webpack": "webpack --config webpack.config.mjs --mode development --watch",
8
- "build-webpack": "webpack --config webpack.config.mjs --mode production"
8
+ "build-webpack": "webpack --config webpack.config.mjs --mode production",
9
+ "lint": "eslint . --ext .ts,.tsx"
9
10
  },
10
11
  "devDependencies": {
12
+ "@webflow/designer-extension-typings": "^0.2.0-beta.8",
13
+ "concurrently": "^8.2.2",
14
+ "eslint": "^8.5.7",
15
+ "@typescript-eslint/eslint-plugin": "^7.7.0",
16
+ "@typescript-eslint/parser": "^7.7.0",
17
+ "typescript": "^5.4.5",
18
+ "react-dom": "^18.2.0",
19
+ "react": "^18.2.0",
20
+ "@types/react": "^18.2.79",
21
+ "@types/react-dom": "^18.2.25",
11
22
  "@babel/preset-env": "^7.23.2",
12
23
  "@babel/preset-react": "^7.22.15",
13
- "@webflow/designer-extension-typings": "*",
14
- "concurrently": "*",
15
24
  "babel-loader": "^9.1.3",
25
+ "ts-loader": "^9.5.1",
16
26
  "webpack": "^5.89.0",
17
- "webpack-cli": "^5.1.4"
27
+ "webpack-cli": "^5.1.4",
28
+ "eslint-plugin-promise": "^6.1.1"
18
29
  },
19
30
  "dependencies": {
20
31
  "react-dom": "^18.2.0"
@@ -10,4 +10,4 @@
10
10
  <div id="root"></div>
11
11
  <script src="./bundle.js"></script>
12
12
  </body>
13
- </html>
13
+ </html>
@@ -1,15 +1,14 @@
1
1
  import React from "react";
2
2
  import ReactDOM from "react-dom";
3
3
 
4
- const App = () => {
4
+ const App: React.FC = () => {
5
5
  const addText = async () => {
6
6
  // Get the current selected Element
7
- let el = await webflow.getSelectedElement();
7
+ const el = await webflow.getSelectedElement();
8
8
 
9
9
  // If text content can be set, update it!
10
- if (el && el.configurable && el.setTextContent) {
11
- el.setTextContent("hello world!");
12
- await el.save();
10
+ if (el && el.textContent) {
11
+ await el.setTextContent("hello world!");
13
12
  } else {
14
13
  alert("Please select a text element");
15
14
  }
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "outDir": "public",
4
+ "target": "es6",
5
+ "lib": ["es6", "dom"],
6
+ "typeRoots": ["./node_modules/@types", "./node_modules/@webflow"],
7
+ "jsx": "react",
8
+ "esModuleInterop": true,
9
+ "baseUrl": "./",
10
+ "paths": {
11
+ "react": ["node_modules/react"],
12
+ "react-dom": ["node_modules/react-dom"]
13
+ }
14
+ },
15
+ "include": ["src/**/*.ts", "src/**/*.tsx"],
16
+ "exclude": ["node_modules"]
17
+ }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "wf-placeholder-name",
3
3
  "publicDir": "public",
4
- "size": "default"
4
+ "size": "default",
5
+ "apiVersion": "2"
5
6
  }
@@ -5,19 +5,20 @@ const filename = fileURLToPath(import.meta.url);
5
5
  const dirname = path.dirname(filename);
6
6
 
7
7
  export default {
8
- entry: "./src/main.js",
8
+ entry: "./src/index.tsx",
9
9
  output: {
10
10
  filename: "bundle.js",
11
11
  path: path.resolve(dirname, "public"),
12
12
  },
13
+ resolve: {
14
+ extensions: [".ts", ".tsx", ".js", ".json"],
15
+ },
13
16
  module: {
14
17
  rules: [
15
18
  {
16
- test: /\.js$/,
19
+ test: /\.(ts|tsx)$/,
17
20
  exclude: /node_modules/,
18
- use: {
19
- loader: "babel-loader",
20
- },
21
+ use: "ts-loader",
21
22
  },
22
23
  {
23
24
  test: /\.css$/,
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": [
3
+ "eslint:recommended",
4
+ "plugin:@typescript-eslint/eslint-recommended",
5
+ "plugin:@typescript-eslint/recommended"
6
+ ],
7
+ "parser": "@typescript-eslint/parser",
8
+ "parserOptions": {
9
+ "project": "./tsconfig.json"
10
+ },
11
+ "plugins": ["@typescript-eslint", "promise"],
12
+ "rules": {
13
+ "@typescript-eslint/explicit-function-return-type": "off",
14
+ "@typescript-eslint/no-explicit-any": "off",
15
+ "@typescript-eslint/no-floating-promises": "error",
16
+ "@typescript-eslint/no-misused-promises": [
17
+ "error",
18
+ { "checksVoidReturn": false }
19
+ ],
20
+ "@typescript-eslint/no-unused-vars": "error",
21
+ "no-async-promise-executor": "error",
22
+ "require-await": "error",
23
+ "promise/catch-or-return": "error"
24
+ }
25
+ }
@@ -5,11 +5,16 @@
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "build": "npm install && tsc -p tsconfig.json && webflow extension bundle",
8
- "dev": "npm install && concurrently -r \"webflow extension serve\" \"tsc -p tsconfig.json --watch --preserveWatchOutput\""
8
+ "dev": "npm install && concurrently -r \"webflow extension serve\" \"tsc -p tsconfig.json --watch --preserveWatchOutput\"",
9
+ "lint": "eslint . --ext .ts"
9
10
  },
10
11
  "devDependencies": {
11
- "@webflow/designer-extension-typings": "*",
12
- "concurrently": "*",
13
- "typescript": "*"
12
+ "@webflow/designer-extension-typings": "^0.2.0-beta.8",
13
+ "@typescript-eslint/eslint-plugin": "^7.7.0",
14
+ "@typescript-eslint/parser": "^7.7.0",
15
+ "eslint": "^8.5.7",
16
+ "concurrently": "^8.2.2",
17
+ "typescript": "^5.4.5",
18
+ "eslint-plugin-promise": "^6.1.1"
14
19
  }
15
20
  }
@@ -2,10 +2,9 @@ document.getElementById("lorem")!.onsubmit = async (event) => {
2
2
  event.preventDefault();
3
3
  const el = await webflow.getSelectedElement();
4
4
  if (el && el.textContent) {
5
- el.setTextContent(
5
+ await el.setTextContent(
6
6
  "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do " +
7
- "eiusmod tempor incididunt ut labore et dolore magna aliqua.",
7
+ "eiusmod tempor incididunt ut labore et dolore magna aliqua."
8
8
  );
9
- el.save();
10
9
  }
11
10
  };
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "wf-placeholder-name",
3
3
  "publicDir": "public",
4
- "size": "comfortable"
4
+ "size": "comfortable",
5
+ "apiVersion": "2"
5
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webflow/webflow-cli",
3
- "version": "1.6.9",
3
+ "version": "1.6.11",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "bin": {
6
6
  "webflow": "./dist/index.js"