drag & drop renewed, imageCropper revisited, imageOrder persisted, css quirks
This commit is contained in:
192
crawler/data/listings.json
Normal file
192
crawler/data/listings.json
Normal file
@@ -0,0 +1,192 @@
|
||||
[
|
||||
{
|
||||
"userId": "8a2b1c5d-7e6f-4g3h-9i1j-2k3l4m5n6o7p",
|
||||
"listingsCategory": "business",
|
||||
"title": "Gourmet Coffee Shop",
|
||||
"description": "<h2>Community-Centric Café</h2><p>A beloved local coffee shop offering a wide variety of gourmet coffees, teas, and handmade pastries. Known for its cozy atmosphere and strong community ties. Ideal for someone passionate about coffee and community engagement.</p>",
|
||||
"type": "2",
|
||||
"state": "CA",
|
||||
"city": "San Francisco",
|
||||
"id": "02JRPQ2YPK7CMXS55XP9G8UIJ2",
|
||||
"price": 220000,
|
||||
"salesRevenue": 340000,
|
||||
"temporary": false,
|
||||
"leasedLocation": false,
|
||||
"established": 2015,
|
||||
"employees": 10,
|
||||
"reasonForSale": "Retirement",
|
||||
"supportAndTraining": "2 weeks of training provided.",
|
||||
"cashFlow": 95000
|
||||
},
|
||||
{
|
||||
"userId": "4q5r6s7t-8u9v-0w1x-2y3z-4a5b6c7d8e9f",
|
||||
"listingsCategory": "business",
|
||||
"title": "Organic Farm Supply",
|
||||
"description": "<h2>Sustainable Agriculture</h2><p>Offering a range of products for organic farming, including seeds, tools, and fertilizers. Committed to promoting sustainable farming practices. A great opportunity for someone with a green thumb and a passion for sustainability.</p>",
|
||||
"type": "3",
|
||||
"state": "OR",
|
||||
"city": "Portland",
|
||||
"id": "03KRQQ3ZPL8DNYS66YQ1H9VJK3",
|
||||
"price": 180000,
|
||||
"salesRevenue": 260000,
|
||||
"temporary": false,
|
||||
"leasedLocation": true,
|
||||
"established": 2017,
|
||||
"employees": 6,
|
||||
"reasonForSale": "Focusing on other ventures",
|
||||
"supportAndTraining": "1 month of comprehensive training.",
|
||||
"cashFlow": 78000
|
||||
},
|
||||
{
|
||||
"userId": "3m4n5o6p-7q8r-9s0t-1u2v-3w4x5y6z7a8b",
|
||||
"listingsCategory": "business",
|
||||
"title": "Modern Italian Restaurant",
|
||||
"description": "<h2>Authentic Italian Cuisine</h2><p>An upscale Italian restaurant known for its modern twist on traditional dishes. Features a full bar and an elegant dining room. A fantastic opportunity for a culinary entrepreneur or chef.</p>",
|
||||
"type": "4",
|
||||
"state": "NY",
|
||||
"city": "New York",
|
||||
"id": "04LRPP4AOQ9ENZT77ZR2I0WKL4",
|
||||
"price": 450000,
|
||||
"salesRevenue": 670000,
|
||||
"temporary": false,
|
||||
"leasedLocation": false,
|
||||
"established": 2012,
|
||||
"employees": 15,
|
||||
"reasonForSale": "New business interests",
|
||||
"supportAndTraining": "Owner willing to consult for 3 months.",
|
||||
"cashFlow": 220000
|
||||
},
|
||||
{
|
||||
"userId": "4q5r6s7t-8u9v-0w1x-2y3z-4a5b6c7d8e9f",
|
||||
"listingsCategory": "business",
|
||||
"title": "Boutique Clothing Store",
|
||||
"description": "<h2>High-End Fashion</h2><p>A boutique store offering an exclusive selection of women's clothing and accessories from top designers. Located in a prime shopping district, it's known for its exceptional customer service and unique fashion finds.</p>",
|
||||
"type": "5",
|
||||
"state": "IL",
|
||||
"city": "Chicago",
|
||||
"id": "05MSQQ5BPRAFO1U88ZS3J1XML5",
|
||||
"price": 310000,
|
||||
"salesRevenue": 430000,
|
||||
"temporary": false,
|
||||
"leasedLocation": true,
|
||||
"established": 2018,
|
||||
"employees": 8,
|
||||
"reasonForSale": "Personal reasons",
|
||||
"supportAndTraining": "3 weeks of training and support.",
|
||||
"cashFlow": 120000
|
||||
},
|
||||
{
|
||||
"userId": "3m4n5o6p-7q8r-9s0t-1u2v-3w4x5y6z7a8b",
|
||||
"listingsCategory": "business",
|
||||
"title": "Tech Startup - Mobile Apps",
|
||||
"description": "<h2>Innovative Technology Solutions</h2><p>A tech startup specializing in developing cutting-edge mobile applications for both iOS and Android. With several successful apps already in the market, this is an exciting opportunity for tech enthusiasts or investors.</p>",
|
||||
"type": "6",
|
||||
"state": "WA",
|
||||
"city": "Seattle",
|
||||
"id": "06NTQR6CQSBGP2V99AT4K2YNM6",
|
||||
"price": 500000,
|
||||
"salesRevenue": 800000,
|
||||
"temporary": false,
|
||||
"leasedLocation": false,
|
||||
"established": 2020,
|
||||
"employees": 20,
|
||||
"reasonForSale": "Seeking new challenges",
|
||||
"supportAndTraining": "Technical and business support for 1 month.",
|
||||
"cashFlow": 300000
|
||||
},
|
||||
{
|
||||
"userId": "8a2b1c5d-7e6f-4g3h-9i1j-2k3l4m5n6o7p",
|
||||
"listingsCategory": "business",
|
||||
"title": "Eco-Friendly Cleaning Service",
|
||||
"description": "<h2>Green Home and Office Cleaning</h2><p>A fast-growing cleaning service that uses eco-friendly products. Offers home and office cleaning with a focus on sustainability and environmentally friendly practices. A perfect venture for those passionate about the environment.</p>",
|
||||
"type": "7",
|
||||
"state": "CO",
|
||||
"city": "Denver",
|
||||
"id": "07OUQR7DRTCGQ3WAAAU5L3ZON7",
|
||||
"price": 90000,
|
||||
"salesRevenue": 150000,
|
||||
"temporary": false,
|
||||
"leasedLocation": true,
|
||||
"established": 2021,
|
||||
"employees": 12,
|
||||
"reasonForSale": "Expanding to new markets",
|
||||
"supportAndTraining": "Comprehensive eco-friendly cleaning training.",
|
||||
"cashFlow": 65000
|
||||
},
|
||||
{
|
||||
"userId": "3m4n5o6p-7q8r-9s0t-1u2v-3w4x5y6z7a8b",
|
||||
"listingsCategory": "business",
|
||||
"title": "Independent Bookstore",
|
||||
"description": "<h2>A Haven for Book Lovers</h2><p>An independent bookstore with a strong community presence, offering a wide range of books, from bestsellers to local authors. Includes a cozy café space for readers to relax and enjoy their books.</p>",
|
||||
"type": "8",
|
||||
"state": "MA",
|
||||
"city": "Boston",
|
||||
"id": "08PVRS8ESUDHR4XBBBV6M4APO8",
|
||||
"price": 130000,
|
||||
"salesRevenue": 210000,
|
||||
"temporary": false,
|
||||
"leasedLocation": false,
|
||||
"established": 2016,
|
||||
"employees": 5,
|
||||
"reasonForSale": "Owner relocating",
|
||||
"supportAndTraining": "Training on operations and inventory management.",
|
||||
"cashFlow": 70000
|
||||
},
|
||||
{
|
||||
"userId": "7w8x9y0z-1a2b-3c4d-5e6f-7g8h9i0j1k2l",
|
||||
"listingsCategory": "business",
|
||||
"title": "Luxury Spa and Wellness Center",
|
||||
"description": "<h2>Ultimate Relaxation and Wellness</h2><p>A luxury spa offering a comprehensive range of services, including massages, facials, and wellness programs. Situated in a tranquil and upscale area, it's the perfect retreat for health and wellness enthusiasts.</p>",
|
||||
"type": "9",
|
||||
"state": "FL",
|
||||
"city": "Miami",
|
||||
"id": "09QWTR9FTVEIS5YCCDW7N5BQP9",
|
||||
"price": 350000,
|
||||
"salesRevenue": 520000,
|
||||
"temporary": false,
|
||||
"leasedLocation": true,
|
||||
"established": 2014,
|
||||
"employees": 18,
|
||||
"reasonForSale": "Pursuing other interests",
|
||||
"supportAndTraining": "Owner available for a smooth transition over 2 months.",
|
||||
"cashFlow": 190000
|
||||
},
|
||||
{
|
||||
"userId": "1g2h3i4j-5k6l-7m8n-9o0p-1q2r3s4t5u6v",
|
||||
"listingsCategory": "business",
|
||||
"title": "Custom Jewelry Shop",
|
||||
"description": "<h2>Exquisite Handcrafted Jewelry</h2><p>A shop specializing in custom-made jewelry, from engagement rings to unique pieces for special occasions. Utilizes high-quality materials and offers a personalized design service.</p>",
|
||||
"type": "10",
|
||||
"state": "NV",
|
||||
"city": "Las Vegas",
|
||||
"id": "10RXUS0GUWFJT6ZDDDX8O6CQR0",
|
||||
"price": 275000,
|
||||
"salesRevenue": 400000,
|
||||
"temporary": false,
|
||||
"leasedLocation": false,
|
||||
"established": 2018,
|
||||
"employees": 4,
|
||||
"reasonForSale": "Health reasons",
|
||||
"supportAndTraining": "Design and crafting training provided.",
|
||||
"cashFlow": 110000
|
||||
},
|
||||
{
|
||||
"userId": "4q5r6s7t-8u9v-0w1x-2y3z-4a5b6c7d8e9f",
|
||||
"listingsCategory": "business",
|
||||
"title": "Digital Marketing Agency",
|
||||
"description": "<h2>Online Branding and Marketing Solutions</h2><p>A full-service digital marketing agency offering SEO, PPC, social media marketing, and web design services. Known for its innovative strategies and results-driven approach. Ideal for those with a background in marketing or business.</p>",
|
||||
"type": "11",
|
||||
"state": "TX",
|
||||
"city": "Dallas",
|
||||
"id": "11SYVT1HVXGKU7AEEEX9P7DRR1",
|
||||
"price": 400000,
|
||||
"salesRevenue": 600000,
|
||||
"temporary": false,
|
||||
"leasedLocation": true,
|
||||
"established": 2019,
|
||||
"employees": 25,
|
||||
"reasonForSale": "Scaling down",
|
||||
"supportAndTraining": "4 weeks of digital marketing training.",
|
||||
"cashFlow": 250000
|
||||
}
|
||||
]
|
||||
142
crawler/data/listings_cp.json
Normal file
142
crawler/data/listings_cp.json
Normal file
@@ -0,0 +1,142 @@
|
||||
[
|
||||
{
|
||||
"id": "2b5c900f-894d-5e48-c987-8cf735170b5f",
|
||||
"temporary": false,
|
||||
"userId": "",
|
||||
"listingsCategory": "commercialProperty",
|
||||
"title": "Downtown Retail Space",
|
||||
"state": "NY",
|
||||
"hasImages": true,
|
||||
"price": 3200000,
|
||||
"city": "New York",
|
||||
"description": "<p>Prime retail space in the heart of New York City. An excellent opportunity for investors to own a piece of the vibrant downtown shopping district. High foot traffic and visibility make this an ideal location for any retail business.</p>",
|
||||
"type": "100",
|
||||
"imageOrder": []
|
||||
},
|
||||
{
|
||||
"id": "3c6d901g-905e-6f59-d098-9dg846280c6g",
|
||||
"temporary": false,
|
||||
"userId": "",
|
||||
"listingsCategory": "commercialProperty",
|
||||
"title": "Expansive Land Development Opportunity",
|
||||
"state": "CA",
|
||||
"hasImages": true,
|
||||
"price": 5000000,
|
||||
"city": "Los Angeles",
|
||||
"description": "<p>Offering a unique opportunity to purchase vast acreage in Los Angeles. Perfect for developers looking to create a new residential community or commercial complex. Accessibility to major highways and urban centers.</p>",
|
||||
"type": "101",
|
||||
"imageOrder": []
|
||||
},
|
||||
{
|
||||
"id": "4d7ea012-h16f-7g6a-e109-feh957390d7h",
|
||||
"temporary": false,
|
||||
"userId": "",
|
||||
"listingsCategory": "commercialProperty",
|
||||
"title": "Industrial Warehouse Complex",
|
||||
"state": "IL",
|
||||
"hasImages": true,
|
||||
"price": 7500000,
|
||||
"city": "Chicago",
|
||||
"description": "<p>A modern industrial warehouse complex suitable for manufacturing or distribution businesses. Features multiple loading docks, office spaces, and state-of-the-art facilities. Strategically located for easy transport access.</p>",
|
||||
"type": "102",
|
||||
"imageOrder": []
|
||||
},
|
||||
{
|
||||
"id": "5e8fb123-i27g-8h7b-f210-gfi0684a1e8i",
|
||||
"temporary": false,
|
||||
"userId": "",
|
||||
"listingsCategory": "commercialProperty",
|
||||
"title": "Luxury Office Building",
|
||||
"state": "TX",
|
||||
"hasImages": true,
|
||||
"price": 8900000,
|
||||
"city": "Houston",
|
||||
"description": "<p>An architectural masterpiece, this luxury office building offers state-of-the-art amenities, including a fitness center, conference rooms, and rooftop gardens. Ideal for businesses looking for a prestigious address.</p>",
|
||||
"type": "103",
|
||||
"imageOrder": []
|
||||
},
|
||||
{
|
||||
"id": "6f9gc234-j38h-9i8c-g311-hgj1795b2f9j",
|
||||
"temporary": false,
|
||||
"userId": "",
|
||||
"listingsCategory": "commercialProperty",
|
||||
"title": "Mixed-Use Building Downtown",
|
||||
"state": "FL",
|
||||
"hasImages": true,
|
||||
"price": 4200000,
|
||||
"city": "Miami",
|
||||
"description": "<p>A prominent mixed-use building featuring retail spaces on the ground floor and modern apartments above. Located in the bustling downtown area, it offers a perfect blend of commercial and residential opportunities.</p>",
|
||||
"type": "104",
|
||||
"imageOrder": []
|
||||
},
|
||||
{
|
||||
"id": "7hagd345-k49i-aj9d-h422-ikj2806c3gak",
|
||||
"temporary": false,
|
||||
"userId": "",
|
||||
"listingsCategory": "commercialProperty",
|
||||
"title": "Multifamily Residential Complex",
|
||||
"state": "WA",
|
||||
"hasImages": true,
|
||||
"price": 6700000,
|
||||
"city": "Seattle",
|
||||
"description": "<p>This modern multifamily complex features a variety of amenities including a gym, pool, and community center. Offering a mix of one, two, and three-bedroom units, it's a perfect investment for steady rental income.</p>",
|
||||
"type": "105",
|
||||
"imageOrder": []
|
||||
},
|
||||
{
|
||||
"id": "8ibhe456-l5aj-bk0e-i533-jkl3917d4hab",
|
||||
"temporary": false,
|
||||
"userId": "",
|
||||
"listingsCategory": "commercialProperty",
|
||||
"title": "Versatile Commercial Property",
|
||||
"state": "CO",
|
||||
"hasImages": true,
|
||||
"price": 3900000,
|
||||
"city": "Denver",
|
||||
"description": "<p>A versatile commercial property that can accommodate various business types, from retail to offices. Located in a high-traffic area, it offers great visibility and accessibility. Ample parking and flexible space configurations available.</p>",
|
||||
"type": "106",
|
||||
"imageOrder": []
|
||||
},
|
||||
{
|
||||
"id": "9jcfi567-m6bk-cl1f-j644-kml4028e5icm",
|
||||
"temporary": false,
|
||||
"userId": "",
|
||||
"listingsCategory": "commercialProperty",
|
||||
"title": "Premier Shopping Center",
|
||||
"state": "AZ",
|
||||
"hasImages": true,
|
||||
"price": 12000000,
|
||||
"city": "Phoenix",
|
||||
"description": "<p>A leading shopping center with a mix of national and local retailers, restaurants, and entertainment options. High annual foot traffic and a loyal customer base make this a highly desirable investment.</p>",
|
||||
"type": "100",
|
||||
"imageOrder": []
|
||||
},
|
||||
{
|
||||
"id": "akdjh678-n7cl-dm2g-k755-lnm5139f6jdn",
|
||||
"temporary": false,
|
||||
"userId": "",
|
||||
"listingsCategory": "commercialProperty",
|
||||
"title": "Expansive Industrial Park",
|
||||
"state": "NV",
|
||||
"hasImages": true,
|
||||
"price": 15000000,
|
||||
"city": "Las Vegas",
|
||||
"description": "<p>An expansive industrial park offering a range of facilities for light manufacturing, warehousing, and logistics. Includes customizable units, ample parking, and is strategically located for easy access to major transport routes.</p>",
|
||||
"type": "102",
|
||||
"imageOrder": []
|
||||
},
|
||||
{
|
||||
"id": "blemj789-o8dm-en3h-l866-mno6240g7keo",
|
||||
"temporary": false,
|
||||
"userId": "",
|
||||
"listingsCategory": "commercialProperty",
|
||||
"title": "High-End Office Suites",
|
||||
"state": "GA",
|
||||
"hasImages": true,
|
||||
"price": 5300000,
|
||||
"city": "Atlanta",
|
||||
"description": "<p>Elegant and modern office suites in a prestigious part of Atlanta. Offers businesses a high-profile location with top-notch amenities, including secure parking, high-speed internet, and on-site management.</p>",
|
||||
"type": "103",
|
||||
"imageOrder": []
|
||||
}
|
||||
]
|
||||
193
crawler/filechooser.ts
Normal file
193
crawler/filechooser.ts
Normal file
@@ -0,0 +1,193 @@
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
// import { prompt, Question} from 'inquirer';
|
||||
import inquirer from 'inquirer';
|
||||
import chalk from 'chalk';
|
||||
|
||||
|
||||
const COMPLETED = 'SELECTION_COMPLETED';
|
||||
const CANCELLED = 'SELECTION_CANCELLED';
|
||||
const CHECKMARK = '\u2713';
|
||||
|
||||
class FilesSystemService {
|
||||
directories(directoryPath, directoryFilter ?: (joinedPath) => true) {
|
||||
return fs.readdirSync(directoryPath).filter((name) => {
|
||||
const joinedPath = path.join(directoryPath, name);
|
||||
return this.isDirectory(joinedPath) && directoryFilter(joinedPath);
|
||||
});
|
||||
}
|
||||
|
||||
files(directoryPath, fileFilter = (joinedPath) => true) {
|
||||
return fs.readdirSync(directoryPath).filter((name) => {
|
||||
const joinedPath = path.join(directoryPath, name);
|
||||
return this.isFile(joinedPath) && fileFilter(joinedPath);
|
||||
});
|
||||
}
|
||||
|
||||
isDirectory(directoryPath) {
|
||||
return fs.statSync(directoryPath).isDirectory();
|
||||
}
|
||||
|
||||
isFile(filePath) {
|
||||
return fs.statSync(filePath).isFile();
|
||||
}
|
||||
}
|
||||
|
||||
class FilesSelectionService extends Set {
|
||||
lastFileSelected = null;
|
||||
constructor(selectedFiles) {
|
||||
super(selectedFiles);
|
||||
}
|
||||
|
||||
get selectedFiles() {
|
||||
return Array.from(this);
|
||||
}
|
||||
|
||||
isSelected(file) {
|
||||
return this.has(file);
|
||||
}
|
||||
|
||||
selectFile(file) {
|
||||
this.add(file);
|
||||
this.lastFileSelected = file;
|
||||
}
|
||||
|
||||
removeFile(file) {
|
||||
this.delete(file);
|
||||
}
|
||||
}
|
||||
|
||||
class LocationService {
|
||||
constructor(public currentPath) {
|
||||
this.currentPath = currentPath;
|
||||
}
|
||||
}
|
||||
|
||||
class OptionsService {
|
||||
constructor(public options) {
|
||||
this.options = { ...this.defaultOptions, ...options };
|
||||
}
|
||||
|
||||
get defaultOptions() {
|
||||
return {
|
||||
directoryFilter: () => true,
|
||||
fileFilter: () => true,
|
||||
root: process.cwd(),
|
||||
startingPath: process.cwd(),
|
||||
multi: true,
|
||||
pageSize: 10,
|
||||
selectedFiles: [],
|
||||
clearConsole: true,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export const selectFiles = function (options = {}) {
|
||||
const optionsService = new OptionsService(options);
|
||||
const locationService = new LocationService(
|
||||
optionsService.options.startingPath
|
||||
);
|
||||
const fileSystemService = new FilesSystemService();
|
||||
const filesSelectionService = new FilesSelectionService(
|
||||
optionsService.options.selectedFiles
|
||||
);
|
||||
|
||||
return new Promise((resolve):FCResult|void => {
|
||||
(async function promptUserToSelectFiles() {
|
||||
const directories = fileSystemService.directories(
|
||||
locationService.currentPath,
|
||||
optionsService.options.directoryFilter
|
||||
);
|
||||
|
||||
if (locationService.currentPath !== optionsService.options.root) {
|
||||
directories.unshift('..');
|
||||
}
|
||||
|
||||
const files = fileSystemService.files(
|
||||
locationService.currentPath,
|
||||
optionsService.options.fileFilter
|
||||
);
|
||||
|
||||
const choices = [
|
||||
...directories.map((directoryName) => {
|
||||
const value = path.join(locationService.currentPath, directoryName);
|
||||
const name = chalk.yellow(directoryName);
|
||||
return { value, name };
|
||||
}),
|
||||
...files.map((fileName) => {
|
||||
const value = path.join(locationService.currentPath, fileName);
|
||||
const name = `${fileName} ${
|
||||
filesSelectionService.isSelected(value)
|
||||
? chalk.green(CHECKMARK)
|
||||
: ''
|
||||
}`;
|
||||
return { value, name };
|
||||
}),
|
||||
];
|
||||
|
||||
if (filesSelectionService.selectedFiles.length) {
|
||||
choices.push({
|
||||
name: chalk.green('-- File Selection Complete --'),
|
||||
value: COMPLETED,
|
||||
});
|
||||
}
|
||||
|
||||
choices.push({
|
||||
name: chalk.red('-- Cancel File Selection --'),
|
||||
value: CANCELLED,
|
||||
});
|
||||
|
||||
if (optionsService.options.clearConsole) {
|
||||
console.clear();
|
||||
}
|
||||
|
||||
const { selection } = await inquirer.prompt([
|
||||
{
|
||||
type: 'list',
|
||||
message: `Select file(s) in ${locationService.currentPath}`,
|
||||
name: 'selection',
|
||||
pageSize: optionsService.options.pageSize,
|
||||
choices,
|
||||
default: () => filesSelectionService.lastFileSelected,
|
||||
},
|
||||
]);
|
||||
|
||||
if (optionsService.options.clearConsole) {
|
||||
console.clear();
|
||||
}
|
||||
|
||||
if (selection === COMPLETED || selection === CANCELLED) {
|
||||
return resolve({
|
||||
selectedFiles: filesSelectionService.selectedFiles,
|
||||
status: selection,
|
||||
});
|
||||
} else if (!optionsService.options.multi) {
|
||||
return resolve({
|
||||
selectedFiles: [selection],
|
||||
status: COMPLETED,
|
||||
});
|
||||
}
|
||||
|
||||
if (fileSystemService.isDirectory(selection)) {
|
||||
locationService.currentPath = selection;
|
||||
} else {
|
||||
if (filesSelectionService.isSelected(selection)) {
|
||||
filesSelectionService.removeFile(selection);
|
||||
} else {
|
||||
filesSelectionService.selectFile(selection);
|
||||
}
|
||||
}
|
||||
|
||||
promptUserToSelectFiles();
|
||||
})();
|
||||
});
|
||||
};
|
||||
export type FCResult = {
|
||||
selectedFiles:Array<string>
|
||||
status:'SELECTION_COMPLETED'|'SELECTION_CANCELLED'
|
||||
}
|
||||
// const exports = {
|
||||
// COMPLETED,
|
||||
// CANCELLED,
|
||||
// selectFiles,
|
||||
// };
|
||||
@@ -1,10 +1,22 @@
|
||||
import fs from 'fs-extra';
|
||||
import { selectFiles } from './filechooser.js';
|
||||
import path from 'path';
|
||||
|
||||
(async () => {
|
||||
const listings = await fs.readJson('./listings.json');
|
||||
const result = await selectFiles({startingPath:'./data',directoryFilter: (directoryName)=>{
|
||||
return false;
|
||||
},fileFilter: (fileName) => {
|
||||
return /\.json$/gi.test(fileName);
|
||||
},pageSize:10,multi:false});
|
||||
console.log(result['selectedFiles'][0]);
|
||||
const file = result['selectedFiles'][0];
|
||||
// const extension = path.extname(file);
|
||||
// const basefileName = path.basename(file,extension);
|
||||
const listings = await fs.readJson(file);
|
||||
//listings.forEach(element => {
|
||||
for (const listing of listings) {
|
||||
const response = await fetch('http://localhost:3000/bizmatch/listings', {
|
||||
const type = listing.listingsCategory
|
||||
const response = await fetch(`http://localhost:3000/bizmatch/listings/${type}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(listing),
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
@@ -15,6 +16,7 @@
|
||||
"dependencies": {
|
||||
"currency.js": "^2.0.4",
|
||||
"fs-extra": "^11.2.0",
|
||||
"inquirer": "^9.2.17",
|
||||
"ioredis": "^5.3.2",
|
||||
"node-fetch": "^3.3.2",
|
||||
"puppeteer": "^22.1.0",
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||
|
||||
/* Language and Environment */
|
||||
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||
"target": "ES2017", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
||||
@@ -25,9 +25,9 @@
|
||||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||
|
||||
/* Modules */
|
||||
"module": "commonjs", /* Specify what module code is generated. */
|
||||
"module": "ESNext", /* Specify what module code is generated. */
|
||||
// "rootDir": "./", /* Specify the root folder within your source files. */
|
||||
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||
@@ -55,7 +55,7 @@
|
||||
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
||||
"outDir": "./build", /* Specify an output folder for all emitted files. */
|
||||
// "removeComments": true, /* Disable emitting comments. */
|
||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||
|
||||
Reference in New Issue
Block a user