tlcodegen
v3.1.12
Published
Welcome to The Lumery's Code Generator! This tool will generate starting files for you to build upon and compile to be able to put into vendor platforms.
Downloads
11
Readme
Introduction
Welcome to The Lumery's Code Generator! This tool will generate starting files for you to build upon and compile to be able to put into vendor platforms.
Getting Started
To setup your environment for code generation you must:
1. Install Bun
Open Visual Studio Code, open the Terminal window. Using your VS Code Terminal, install Bun globally.
Powershell: powershell -c "irm bun.sh/install.ps1|iex"
NPM: npm install -g bun
2. Install TLCodeGen
In terminal type: bun add tlcodegen
3. Install dependant packages
In terminal type: bun install
Using the project
TLCodeGen Menu
This function will display a list of built in functions: bun tlcodegen
Initialise project
This function creates the folder and files that are relevant for the project.
To initialise a project: bun tlcodegen init-project
This function creates the following:
- .gitignore file
- Updates the cgconfig file with the chosen platform
- Foundations directory and base branding SASS files
- Copies platform specific templates to foundations directory
Generating campaign
This function creates the folder and files for an individual campaign.
To generate a campaign: bun tlcodegen generate-campaign
This will ask you for the:
- Campaign code (i.e the JIRA task code - EXP123)
- Number of variants - including the control variant.
Adding Variant
This function adds a new variant into the selected campaign.
To add a new variant: bun tlcodegen add-variant
This will ask you for the:
- Campaign code (i.e. the JIRA task code - EXP123)
The function counts the number of variant folders, and then adds a new variant using the next alpha char. It requires the variant sequence to remain unbroken. As such, if you have previously deleted an variant it will error. For example, if you previously had four variants (A,B,C,D) and then deleted 'C' - this function will try and add a 'D' variant again.
Duplicating Variant
This function duplicates an existing variant into a new campaign.
To duplicate an variant: bun tlcodegen duplicate-variant
This will ask you for the:
- Existing Campaign code (i.e. the JIRA task code - EXP123)
- New campaign code (i.e. the JIRA task code - EXP124)
This function copies all existing files into new campaign. It runs a search and replace over the code, replacing the old code with the new.
Building\Running campaign
This function will compile & watch the Typescript and SASS files. It will also host those files (in localhost:3000).
To generate a campaign: bun tlcodegen dev
This will ask you for the:
- Campaign code (i.e the JIRA task code - EXP123)
- Variant - The specific variant you are working on.
This will only compile the specific variant you are working on.
Unit Testing campaign/variant
Setting up TamperMonkey
Install the "TamperMonkey" Chrome browser extension.
Create a new TamperMonkey script:
- Copy and paste following code into editor
// ==UserScript==
// @name {{CLIENT - NAME}} Dev Environment
// @namespace http://thelumery.com/
// @version 0.1
// @description The Lumery | {{CLIENT - NAME}} Dev Environment
// @author The Lumery
// @match {{CLIENT - URL PATTERN}}
// @icon {{CLIENT - FAVICON URL}}
// @grant GM_log
// ==/UserScript==
(function() {
'use strict';
const scriptTag = document.createElement('script');
const styleSheet = document.createElement('link');
scriptTag.setAttribute(
'src',
'http://localhost:3000/script.js',
);
styleSheet.setAttribute('rel', 'stylesheet');
styleSheet.setAttribute('href', 'http://localhost:3000/style.css');
document.head.append(scriptTag)
document.head.append(styleSheet)
})();
Update
{{CLIENT}}
VariablesType
Ctrl + S