-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
figma-bot
committed
Dec 5, 2024
1 parent
24ef296
commit 3d2068b
Showing
26 changed files
with
235 additions
and
2,572 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
cli/src/connect/__test__/e2e/e2e_parse_command/raw/figma.config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"codeConnect": { | ||
"parser": "react", | ||
"importPaths": {}, | ||
"paths": {}, | ||
"include": [ | ||
"*.{tsx, jsx}", | ||
"*.figma.template.js" | ||
], | ||
"exclude": [] | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
cli/src/connect/__test__/e2e/e2e_parse_command/raw/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "tests", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"react": "^18.3.1" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
cli/src/connect/__test__/e2e/e2e_parse_command/raw/test-component.figma.template.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// url=https://figma.com/design/abc?node=1:1 | ||
const figma = require('figma') | ||
const text = figma.currentLayer.__properties__.string('Text') | ||
|
||
export default figma.code`def python_code(): | ||
return ${text}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
cli/src/connect/__test__/e2e/e2e_parse_command_raw.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { promisify } from 'util' | ||
import { exec } from 'child_process' | ||
import { tidyStdOutput } from '../../../__test__/utils' | ||
import path from 'path' | ||
|
||
describe('e2e test for `parse` command (raw)', () => { | ||
const cliVersion = require('../../../../package.json').version | ||
|
||
it('successfully parses raw template file', async () => { | ||
const testPath = path.join(__dirname, 'e2e_parse_command/raw') | ||
|
||
const result = await promisify(exec)( | ||
`npx tsx ../../../cli connect parse --skip-update-check --dir ${testPath} --include-raw-templates`, | ||
{ | ||
cwd: __dirname, | ||
}, | ||
) | ||
|
||
expect(tidyStdOutput(result.stderr)).toBe( | ||
`Config file found, parsing ${testPath} using specified include globs`, | ||
) | ||
|
||
const json = JSON.parse(result.stdout) | ||
|
||
expect(json).toMatchObject([ | ||
{ | ||
figmaNode: 'https://figma.com/design/abc?node=1:1', | ||
label: 'Code', | ||
language: 'raw', | ||
source: '', | ||
sourceLocation: { line: -1 }, | ||
template: `const figma = require('figma') | ||
const text = figma.currentLayer.__properties__.string('Text') | ||
export default figma.code\`def python_code(): | ||
return \${text}\` | ||
`, | ||
templateData: {}, | ||
metadata: { | ||
cliVersion, | ||
}, | ||
}, | ||
]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.