Skip to content

Commit 86f97fb

Browse files
committed
PLT-0 - init
* init parser based on original sls code
1 parent d2d5900 commit 86f97fb

39 files changed

+7013
-0
lines changed

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@Flaconi/platform @Flaconi/ci

.github/dependabot.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: 2
2+
registries:
3+
npm-npmjs:
4+
type: npm-registry
5+
url: https://registry.npmjs.org
6+
replaces-base: true
7+
token: ${{ secrets.NPM_TOKEN }}
8+
github-flaconi-ci:
9+
type: git
10+
url: https://github.com
11+
username: x-access-token
12+
password: ${{secrets.REPO_READ_TOKEN}}
13+
updates:
14+
- package-ecosystem: npm
15+
directory: "/"
16+
schedule:
17+
interval: daily
18+
time: "08:00"
19+
timezone: Europe/Berlin
20+
open-pull-requests-limit: 10
21+
registries:
22+
- npm-npmjs
23+
- package-ecosystem: github-actions
24+
directory: "/"
25+
schedule:
26+
interval: weekly
27+
day: monday
28+
time: "08:00"
29+
timezone: Europe/Berlin
30+
registries:
31+
- github-flaconi-ci

.github/release-drafter.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Configuration for Release Drafter: https://github.com/toolmantim/release-drafter
2+
template: |
3+
## Changes
4+
5+
$CHANGES
6+
name-template: '$RESOLVED_VERSION 🌈'
7+
tag-template: '$RESOLVED_VERSION'
8+
categories:
9+
- title: '🚀 Features'
10+
labels:
11+
- feature
12+
- enhancement
13+
- title: '🐛 Bug Fixes'
14+
labels:
15+
- fix
16+
- bugfix
17+
- bug
18+
- title: '🧰 Maintenance'
19+
labels:
20+
- chore
21+
- dependencies
22+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
23+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
24+
version-resolver:
25+
major:
26+
labels:
27+
- 'major'
28+
minor:
29+
labels:
30+
- 'minor'
31+
patch:
32+
labels:
33+
- 'patch'
34+
default: patch
35+

.github/workflows/auto-merge.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name: Dependabot auto-merge
3+
4+
on: pull_request
5+
6+
jobs:
7+
auto-merge:
8+
uses: Flaconi/github-actions/.github/workflows/auto-merge.yml@v1
9+
secrets: inherit

.github/workflows/backups.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Backup Repository
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
backup:
11+
uses: Flaconi/github-reusable-workflow/.github/workflows/backups.yml@v1
12+
with:
13+
enabled: True
14+
region: eu-central-1
15+
secrets:
16+
iam_role_arn: ${{ secrets.BACKUP_REPO_IAM_ROLE }}
17+
bucket_name: ${{ secrets.BACKUP_REPO_BUCKET }}

.github/workflows/build.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
name: Build Node
3+
on:
4+
workflow_call:
5+
inputs:
6+
node_version:
7+
type: string
8+
default: '20'
9+
skip:
10+
type: boolean
11+
required: false
12+
default: false
13+
description: should the steps be skipped
14+
jobs:
15+
compile:
16+
timeout-minutes: 5
17+
if: ${{ always() && ! inputs.skip }}
18+
runs-on: ubuntu-24.04
19+
permissions:
20+
contents: read
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
show-progress: false
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ inputs.node_version }}
28+
cache: 'yarn'
29+
- run: yarn install --immutable
30+
- run: yarn compile
31+
32+
lint:
33+
timeout-minutes: 5
34+
if: ${{ ! inputs.skip }}
35+
runs-on: ubuntu-24.04
36+
needs: [compile]
37+
permissions:
38+
contents: read
39+
steps:
40+
- uses: actions/checkout@v4
41+
with:
42+
show-progress: false
43+
- uses: actions/setup-node@v4
44+
with:
45+
node-version: ${{ inputs.node_version }}
46+
cache: 'yarn'
47+
- run: yarn install --immutable
48+
- run: yarn lint
49+
test:
50+
timeout-minutes: 5
51+
runs-on: ubuntu-24.04
52+
if: ${{ ! inputs.skip }}
53+
needs: [compile]
54+
permissions:
55+
contents: read
56+
steps:
57+
- uses: actions/checkout@v4
58+
with:
59+
show-progress: false
60+
- uses: actions/setup-node@v4
61+
with:
62+
node-version: ${{ inputs.node_version }}
63+
cache: 'yarn'
64+
- run: yarn install --immutable
65+
- run: yarn test

.github/workflows/release-drafter.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
name: Release Drafter
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
update_release_draft:
11+
uses: Flaconi/github-actions/.github/workflows/release-drafter.yml@v1
12+
secrets: inherit

.github/workflows/release.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
name: Release deploy
3+
4+
on:
5+
push:
6+
branches: [ "**" ]
7+
tags-ignore: [ "**" ]
8+
release:
9+
types: [ published ]
10+
11+
jobs:
12+
# changed_files:
13+
# if: ${{ !contains(github.ref, 'refs/tags/') }}
14+
# runs-on: ubuntu-24.04
15+
# name: Test changed-files
16+
# outputs:
17+
# src_any_changed: ${{ steps.changed-files.outputs.src_any_changed }}
18+
# steps:
19+
# - uses: actions/checkout@v4
20+
# with:
21+
# fetch-depth: 0
22+
# - uses: nrwl/nx-set-shas@v4
23+
# id: last_successful_commit_push
24+
# with:
25+
# main-branch-name: ${{ github.event.repository.default_branch }}
26+
# workflow-id: 'release.yml'
27+
# - name: Get changed files
28+
# id: changed-files
29+
# uses: tj-actions/changed-files@v45
30+
# with:
31+
# files_yaml_from_source_file: changed-files.yml
32+
# base_sha: ${{ steps.last_successful_commit_push.outputs.base }}
33+
# - name: List all changed files
34+
# run: |
35+
# echo "${{ toJSON(steps.changed-files.outputs) }}"
36+
build:
37+
if: ${{ !contains(github.ref, 'refs/tags/') }}
38+
# needs: changed_files
39+
uses: ./.github/workflows/build.yml
40+
with:
41+
node_version: "18"
42+
skip: ${{ github.event.pusher.name == 'bot-shop-ci' }} #&& needs.changed_files.outputs.src_any_changed != 'true' }}
43+
secrets: inherit
44+
# prerelease:
45+
# needs: [changed_files, build]
46+
# if: ${{ needs.changed_files.outputs.src_any_changed == 'true' && !contains(github.ref, 'refs/tags/') }}
47+
# uses: Flaconi/github-actions/.github/workflows/publish-node.yml@v1
48+
# with:
49+
# branch: ${{ github.ref_name }}
50+
# version: --preid beta.${{ github.run_id }} prerelease
51+
# yarn_command_post_version: build
52+
# pre_release: true
53+
# secrets: inherit
54+
55+
# publish:
56+
# if: ${{ contains(github.ref, 'refs/tags/') }}
57+
# uses: Flaconi/github-actions/.github/workflows/publish-node.yml@v1
58+
# with:
59+
# yarn_command_post_version: build
60+
# secrets: inherit

.gitignore

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# macOS
2+
.DS_Store
3+
4+
# Logs
5+
logs
6+
*.log
7+
npm-debug.log*
8+
yarn-debug.log*
9+
yarn-error.log*
10+
11+
# Coverage directory generated when running tests with coverage
12+
coverage
13+
14+
# Dependencies
15+
node_modules/
16+
17+
# Yarn files
18+
.pnp.*
19+
.yarn/*
20+
!.yarn/patches
21+
!.yarn/plugins
22+
!.yarn/releases
23+
!.yarn/sdks
24+
!.yarn/versions
25+
26+
# Node version directives
27+
.nvmrc
28+
29+
# dotenv environment variables file
30+
.env
31+
.env.test
32+
33+
# Build output
34+
dist
35+
dist-types
36+
37+
# Temporary change files created by Vim
38+
*.swp
39+
40+
41+
# Local configuration files
42+
*.local.yaml
43+
44+
# Sensitive credentials
45+
*-credentials.yaml
46+
47+
# vscode database functionality support files
48+
*.session.sql
49+
50+
.idea

.yarn/releases/yarn-4.6.0.cjs

+934
Large diffs are not rendered by default.

.yarnrc.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
nodeLinker: node-modules
2+
3+
yarnPath: .yarn/releases/yarn-4.6.0.cjs

changed-files.yml

Whitespace-only changes.

package.json

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "@flaconi/serverless-file-parser",
3+
"version": "1.0.0",
4+
"main": "dist/index.js",
5+
"module": "dist/index.es.js",
6+
"types": "dist/src/index.d.ts",
7+
"files": [
8+
"dist",
9+
"README.md"
10+
],
11+
"scripts": {
12+
"compile": "tsc",
13+
"build": "rm -rf dist && rollup -c rollup.config.mjs",
14+
"test": "vitest run --coverage",
15+
"lint": "exit 0"
16+
},
17+
"type": "module",
18+
"keywords": [],
19+
"author": "[email protected]",
20+
"license": "MIT",
21+
"description": "",
22+
"packageManager": "[email protected]",
23+
"devDependencies": {
24+
"@types/node": "^22.13.1",
25+
"@vitest/coverage-v8": "3.0.5",
26+
"rollup": "^4.34.7",
27+
"typescript": "^5.7.3",
28+
"vitest": "^3.0.5"
29+
},
30+
"dependencies": {
31+
"@rollup/plugin-commonjs": "^28.0.2",
32+
"@rollup/plugin-node-resolve": "^16.0.0",
33+
"memoize": "^10.0.0",
34+
"rollup-plugin-typescript2": "^0.36.0",
35+
"tokenizr": "^1.7.0",
36+
"type": "^2.7.3"
37+
}
38+
}

rollup.config.mjs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import typescript from 'rollup-plugin-typescript2';
2+
import resolve from '@rollup/plugin-node-resolve';
3+
import commonjs from '@rollup/plugin-commonjs';
4+
export default {
5+
input: 'src/index.ts',
6+
output: [
7+
{
8+
file: "dist/index.js",
9+
format: 'cjs', // commonJS
10+
},
11+
{
12+
file: "dist/index.es.js",
13+
format: 'esm', // ES Modules
14+
},
15+
],
16+
plugins: [resolve(), commonjs({
17+
exclude: 'node_modules',
18+
ignoreGlobal: true,
19+
}), typescript()],
20+
};

src/errors/parse.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class ParsingError extends TypeError{
2+
constructor(readonly message: string, private readonly code?: ParsingErrorCodes) {
3+
super(message);
4+
}
5+
}
6+
7+
8+
export enum ParsingErrorCodes {
9+
INVALID_VARIABLE_STRING_LITERAL = 1,
10+
INVALID_VARIABLE_LITERAL_SOURCE,
11+
INVALID_VARIABLE_TYPE,
12+
INVALID_VARIABLE_SOURCE ,
13+
INVALID_VARIABLE_PARAM,
14+
INVALID_VARIABLE_ADDRESS,
15+
UNTERMINATED_VARIABLE,
16+
}
17+
18+
export default ParsingError;

0 commit comments

Comments
 (0)